////////////////////// BEGIN REPORT GENERATOR SECTION ////////////////////// function getXMLHTTPREQUEST(){ var xRequest = null; if( window.XMLHttpRequest ){ xRequest = new XMLHttpRequest(); } else if( typeof ActiveXObject != "undefined" ){ xRequest = new ActiveXObject( "Microsoft.XMLHTTP" ); } return xRequest; } // top.rptGenWindow is a top level global set in index_app.htm function checkRptGenWindow() { if( !top.rptGenWindow.closed && top.rptGenWindow.location ){ return true; } else { return false; } } function setNetcapeSec(){ try { if ( window.netscape && window.netscape.security.PrivilegeManager.enablePrivilege ) { netscape.security.PrivilegeManager.enablePrivilege( "UniversalBrowserRead" ); } } catch (ex) { } } function reportGeneratorSubmit( cc_text_id_list, all, or, exact, booleanP, group ){ var start = ( top.f_toolbar_bottom_controls.video_shorten_lengthen_start ) ? top.f_toolbar_bottom_controls.video_shorten_lengthen_start : 0; var duration = ( top.f_toolbar_bottom_controls.video_shorten_lengthen_end ) ? top.f_toolbar_bottom_controls.video_shorten_lengthen_end : 59; if( !group ) { var cc_text_id_split = cc_text_id_list.split( "^" ); for( var i=0; i 10 ) { top.rptGenWindow = window.open( url, 'rptGenWindow', winProps ); top.rptGenWindow.focus(); } else // if php function: session_id is returning 0 { document.location = "ctv_content_logoff.php"; } //top.rptGenWindow = window.open( url, 'rptGenWindow', winProps ); //top.rptGenWindow.focus(); } function launchClipSyndicateEditorLog( php_session_id, user_client_id ) { var winH = screen.height - 200; win_width = 850; if( screen.availWidth <= 820 ) { win_width = 760; } var winProps = 'width=' + win_width + ',height=' + winH + ',toolbar=yes,location=no,' + 'directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes'; var url = top.f_content.clipSyndicateHostName + "clip_syndicate_log.php" + "?php_session_id=" + php_session_id + "&user_client_id=" + user_client_id; if( php_session_id != "" && php_session_id != "0" && php_session_id.length > 10 ) { top.rptGenWindow = window.open( url, 'rptGenWindow', winProps ); top.rptGenWindow.focus(); } else // if php function: session_id is returning 0 { document.location = "ctv_content_logoff.php"; } } function launchClipSyndicateEditorX( php_session_id, user_session_id, user_client_id, cc_text_id, all, or, exact, booleanP, group ) { var winH = screen.height - 200; if( !group ){ group = false; } // get start and end second values START var clip_start_value = top.f_toolbar_bottom_controls.video_shorten_lengthen_start_true_val; var clip_end_value = top.f_toolbar_bottom_controls.video_shorten_lengthen_end_true_val; if( clip_end_value == 59 ) { clip_end_value = 70; // if editor has selected "60", we will set value in playlist to "70" to be sure that video files that are slightly over 60 seconds play in full } var cc_text_id_string = ""; var checkbox_value_array = ""; //hard coded upper limit of expanded view minutes = 7 for ( var i = 1; i < 8 ; i++ ) { //if a minute is selected, get the CC_TEXT_ID if ( top.f_content.document.getElementById("checkbox_id" + i ) && top.f_content.document.getElementById("checkbox_id" + i).checked == true ) { //split checkbox_id.value on first parameter which is CC_TEXT_ID checkbox_value_array = top.f_content.document.getElementById("checkbox_id" + i).value.split("|"); cc_text_id_string += checkbox_value_array[0] + "|0|70^"; } } cc_text_id_string = cc_text_id_string.slice( 0, cc_text_id_string.length - 1 ); // grab selected minute count START this.formName = top.f_content.document.commandCenter; var selected_elements = ""; var flag = false; var winProps = 'width=760,height='+winH+',toolbar=yes,location=no,' + 'directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes'; var url = top.f_content.clipSyndicateHostName + "clip_syndicate_editor_main.php" + "?php_session_id=" + php_session_id + "&user_session_id=" + user_session_id + "&user_client_id=" + user_client_id + "&cc_text_id=" + cc_text_id_string + "&all=" + all + "&or=" + or + "&exact=" + exact + "&boolean=" + booleanP + "&group=" + group; if( php_session_id != "" && php_session_id != "0" && php_session_id.length > 10 ) { top.rptGenWindow = window.open( url, 'rptGenWindow', winProps ); top.rptGenWindow.focus(); } else // if php function: session_id is returning 0 { document.location = "ctv_content_logoff.php"; } //top.rptGenWindow = window.open( url, 'rptGenWindow', winProps ); //top.rptGenWindow.focus(); } function openRptGenWin( user_session_id, user_client_id, playable_video_links, nielsen, sqad ){ var winH = screen.height - 200; //need to open destination window first var winProps = 'width=760,height='+winH+',toolbar=yes,location=no,' + 'directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes'; top.rptGenWindow = window.open( top.f_content.components_root + "report_builder/report_builder_main.php" + "?user_session_id=" + user_session_id + "&user_client_id=" + user_client_id + "&playable_video_links=" + playable_video_links + "&nielsen=" + nielsen + "&sqad=" + sqad, 'rptGenWindow', winProps ); //Focus pop-up window each time it's invoked top.rptGenWindow.focus(); } ////////////////////// END REPORT GENERATOR SECTION ////////////////////// ///////////////////// BEGIN REPORT BUILDER 2 SECTION//////////////////// function saveOpenWindow() { // var reportWindow = top.rptGenWindow; // if(reportWindow != null) // { // if(reportWindow.criticalEditor != null) // reportWindow.criticalEditor.save(); // } } function addEntryToReport(clips, user_client_id, search_ref, user_session_id, isAlert, isClipboard, source) { //saveOpenWindow(); if(clips!=undefined && clips != "") { var winH = screen.height - 200; var start = ( top.f_toolbar_bottom_controls.video_shorten_lengthen_start ) ? top.f_toolbar_bottom_controls.video_shorten_lengthen_start : 0; var duration = ( top.f_toolbar_bottom_controls.video_shorten_lengthen_end ) ? top.f_toolbar_bottom_controls.video_shorten_lengthen_end : 59; //need to open destination window first var winProps = "width=925,height="+winH+",toolbar=yes,location=yes, "+ "directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes"; var url = top.f_content.components_root +"report_builder2/addEntryToReport.php?clips="+clips +"&user_client_id="+user_client_id +"&user_session_id="+user_session_id +"&search_ref="+search_ref +"&start="+start +"&end="+duration +"&isAlert="+isAlert +"&isClipboard="+isClipboard +"&source="+source; top.rptGenWindow = window.open( url, 'rptGenWindow', winProps ); //Focus pop-up window each time it's invoked top.rptGenWindow.focus(); } else{ alert("Please select a clip."); } } function addArchiveEntryToReport(clips, user_client_id, search_ref, user_session_id, isAlert, isClipboard) { saveOpenWindow(); if(clips!=undefined && clips != "") { var winH = screen.height - 200; var start = ( top.f_toolbar_bottom_controls.video_shorten_lengthen_start ) ? top.f_toolbar_bottom_controls.video_shorten_lengthen_start : 0; var duration = ( top.f_toolbar_bottom_controls.video_shorten_lengthen_end ) ? top.f_toolbar_bottom_controls.video_shorten_lengthen_end : 59; //need to open destination window first var winProps = "width=925,height="+winH+",toolbar=yes,location=yes, "+ "directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes"; var url = top.f_content.components_root +"report_builder2/addArchiveEntryToReport.php?clips="+clips +"&user_client_id="+user_client_id +"&user_session_id="+user_session_id +"&search_ref="+search_ref +"&start="+start +"&end="+duration +"&isAlert="+isAlert +"&isClipboard="+isClipboard; top.rptGenWindow = window.open( url, 'rptGenWindow', winProps ); //Focus pop-up window each time it's invoked top.rptGenWindow.focus(); } else{ alert("Please select a clip."); } } function addCgmEntryToReport(clips, user_client_id, search_ref, user_session_id) { saveOpenWindow(); if(clips!=undefined && clips != "") { var winH = screen.height - 200; //need to open destination window first var winProps = "width=925,height="+winH+",toolbar=yes,location=yes, "+ "directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes"; top.rptGenWindow = window.open( top.f_content.components_root + "report_builder2/addCgmEntryToReport.php?clips="+clips +"&user_client_id="+user_client_id +"&user_session_id="+user_session_id +"&search_ref="+search_ref, 'rptGenWindow', winProps ); //Focus pop-up window each time it's invoked top.rptGenWindow.focus(); } else{ alert("Please select a clip."); } } function postAllToReport(search_ref, user_client_id, source, sortby, user_session_id) { saveOpenWindow(); var winH = screen.height - 200; //need to open destination window first var winProps = 'width=925,height='+winH+',toolbar=yes,location=yes,' + 'directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes'; top.rptGenWindow = window.open( top.f_content.components_root + "report_builder2/postAllToReport.php?search_ref="+search_ref + "&user_client_id="+user_client_id + "&user_session_id="+user_session_id + "&search_ref="+search_ref + "&sortby="+sortby + "&source="+source, 'rptGenWindow', winProps ); //Focus pop-up window each time it's invoked top.rptGenWindow.focus(); } function postAlertToReport(alert_ref, user_client_id, start_time, end_time, user_session_id) { saveOpenWindow(); var winH = screen.height - 200; //need to open destination window first var winProps = 'width=925,height='+winH+',toolbar=yes,location=yes,' + 'directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes'; top.rptGenWindow = window.open( top.f_content.components_root + "report_builder2/postAlertToReport.php?alert_ref="+alert_ref + "&user_client_id="+user_client_id + "&user_session_id="+user_session_id + "&start_time="+start_time + "&end_time="+end_time, 'rptGenWindow', winProps ); //Focus pop-up window each time it's invoked top.rptGenWindow.focus(); } function generateClipListFromExpand() { //Taken from old report builder code. var cc_text_id_string = ""; var checkbox_value_array = ""; //hard coded upper limit of expanded view minutes = 7 for ( var i = 1; i < 8 ; i++ ) { //if a minute is selected, get the CC_TEXT_ID if ( top.f_content.document.getElementById("checkbox_id" + i ) && top.f_content.document.getElementById("checkbox_id" + i).checked == true ) { //split checkbox_id.value on first parameter which is CC_TEXT_ID checkbox_value_array = top.f_content.document.getElementById("checkbox_id" + i).value.split("|"); //concat "^" to each CC_TEXT_ID cc_text_id_string += checkbox_value_array[0] + "|"; } } return cc_text_id_string; } function openReportManager(user_client_id, user_session_id) { var winH = screen.height - 200; //need to open destination window first var winProps = 'width=925,height='+winH+',toolbar=yes,location=yes,' + 'directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes'; top.rptGenWindow = window.open( top.f_content.components_root + "report_builder2/manageReports.php?user_client_id="+user_client_id + "&user_session_id="+user_session_id, 'rptGenWindow', winProps ); //Focus pop-up window each time it's invoked top.rptGenWindow.focus(); } //////////////////////// END REPORT BUILDER 2 SECTION/////////////////// //URL GOTO function function urlGoto( url ) { top.f_content.document.location = url; } //Load pacifier function function loadPacifier( pacifier_name, url_destination ) { var url_destination_encoded = new String( url_destination ); //Ascii codes: ? - %3f, = - %3d, & - %26 // only need to encode ampersands url_destination_encoded = url_destination_encoded.replace( /\&/g, "%26" ); top.f_content.document.location = "ctv_ui_pacifier.php?pacifier_name=" + pacifier_name + "&url_destination=" + url_destination_encoded; } function displayScreenshot( i, t ) { //alert("1result_is_locked=" + result_is_locked); if( !result_is_locked || one_time_update_allowed ) //if( !result_is_locked ) { //if( !top.f_content.video_player_loaded ) //alert( parent.f_video.document.images["screenshot_placeholder"] ); if( !video_player_loaded && parent.f_video.document.images["screenshot_placeholder"] ) { parent.f_video.document.images["screenshot_placeholder"].src = i; displayCCText( t ); } } } function jdcm_changeSearchResultsInitAllResults() { current_selected_result.className = 'content_search_result_row'; } function displayCCText( t ) { //parent.f_cc_text.cc1.innerHTML = t; parent.f_cc_text.document.getElementById("cc1").innerHTML = t; } //function jdcm_displayBroadcastLogo (b, t, con) function jdcm_displayBroadcastLogo( t, con ) { if( !result_is_locked || one_time_update_allowed ) { var logo_url; if( parent.f_video.document.getElementById("v1") ) { parent.f_video.document.getElementById("v1").innerHTML = t; } if (result_is_locked) { one_time_update_allowed = false; //alert(b + 'zzz' + t); } } } var results_load_complete = false; var search_result_selected; var current_selected_result = 'sr1'; var result_is_locked = false; var one_time_update_allowed = false; var video_is_playing = false; var video_player_loaded = false; function jdcm_changeSearchResultsOnMouseOver( d ) { if( d.className == 'content_search_result_row' && !result_is_locked ) { d.className='content_search_result_row_mouseover'; search_result_selected = d; } } function jdcm_changeSearchResultsOnMouseOut( d ) { //alert(search_result_selected); if( search_result_selected == d ) { d.className='content_search_result_row'; } } function jdcm_initScreenshot( w ) { parent.f_video.location = "ctv_video.php"; if( w != 1 ) { parent.f_cc_text.location = "ctv_cc_text.php"; } } function jdcm_changeSearchResultsOnClick( i, ct, t, d, con ) { if( result_is_locked && video_is_playing ) // uncomment if statement when play video is using js function { //if( !top.f_content.video_player_loaded ) if( !video_player_loaded ) { jdcm_initScreenshot( 1 ); one_time_update_allowed = true; //alert('just set one_time_update_allowed to true'); displayScreenshot( i, ct ); jdcm_displayBroadcastLogo( t, con ); } //alert('aaa'); } else // if result is locked and clicking on another result row { //if( !top.f_content.video_player_loaded ) if( !video_player_loaded ) { //alert('zoo'); //alert(i); one_time_update_allowed = true; displayScreenshot( i, ct ); jdcm_displayBroadcastLogo( t, con ); } //alert('zoo'); } if( current_selected_result != d ) { //alert("iii"); jdcm_changeSearchResultsInitAllResults(); result_is_locked = false; } //if (d.className == 'resultsItemSelectClicked') if( d.className == 'content_search_result_row_onclick' ) { //alert("unlocking row"); //d.className='resultsItem'; jdcm_initScreenshot(); d.className='content_search_result_row'; result_is_locked = false; video_player_loaded = false; } else { //alert("locking row"); //d.className='resultsItemSelectClicked'; d.className='content_search_result_row_onclick'; current_selected_result = d; result_is_locked = true; } search_result_selected = 0; // div instance will never have value of 0, therefore this will prevent mouseout from changing class name if div has been clicked if( video_is_playing ) { video_is_playing = false; } } function jdcm_loadCCText( t ) { //parent.f_cc_text.cc1.innerHTML = t; parent.f_cc_text.document.getElementById("cc1").innerHTML = t; } function jdcm_playVideo( u, d, t, c, m, v ) { if( v == "1" ) { video_player_loaded = true; d.className='content_search_result_row_onclick'; current_selected_result = d; result_is_locked = true; jdcm_loadCCText( t ); u = escape( u ); parent.f_video.location = "ctv_video_play.php?video_clip=" + u + "&playmode=" + m + "&cc_text_ids=" + c; } else if( v == "2" ) // if mac user, launch video player { parent.f_video.location = "ctv_video_play.asx?video_clip=" + u + "&playmode=" + m + "&cc_text_ids=" + c + "&shorten_lengthen_values=0|0"; //parent.f_video.location = "ctv_video_play_mac.php?video_clip=" + u + "&playmode=" + m + "&cc_text_ids=" + c + "&shorten_lengthen_values=0|0"; } else if ( v == "3" ) { video_player_loaded = true; d.className='content_search_result_row_onclick'; current_selected_result = d; result_is_locked = true; jdcm_loadCCText( t ); parent.f_video.location.href = "ctv_video_play_swf.php?video_clip=" + u + "&autoplay=1"; } else if ( v == "4" ) { video_player_loaded = true; d.className='content_search_result_row_onclick'; current_selected_result = d; result_is_locked = true; jdcm_loadCCText( t ); parent.f_video.location.href = "ctv_video_play_flash.php?clip_data=" + c + "|0|59&autoplay=1"; } else if ( v == "5" ) { d.className='content_search_result_row_onclick'; current_selected_result = d; result_is_locked = true; jdcm_loadCCText( t ); parent.f_video.location.href = "ctv_video_play_pixsy.php?cc_text_id=" + c; } else { alert( "Sorry, video not available." ); } } function openThirdParty(location) { if(confirm("This video is available on a third-party site. Would you like to open the page in a new window?")) { var winProps = 'toolbar=yes,location=yes,' + 'directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes'; top.window.open(location, "thirdparty", winProps); } } function playVideoFromHome( u, c, v ) { if( v == "1" ) { u = escape( u ); parent.f_video.location = "ctv_video_play.php?video_clip=" + u + "&playmode=search" + "&cc_text_ids=" + c; } else if( v == "2" ) // if mac user, launch video player { parent.f_video.location = "ctv_video_play.asx?video_clip=" + u + "&playmode=search" + "&cc_text_ids=" + c + "&shorten_lengthen_values=0|0"; } else { alert( "Sorry, video not available." ); } } function jdcm_showHourglass() { parent.f_content.document.body.style.cursor = "wait"; } function setImageSource( frame_name, image_name, image_file ) { top.frames[frame_name].document.images[image_name].src = image_file; } var genre_checkboxes_screen_w = 0; var genre_checkboxes_URL = ""; function checkScreenWidth( url ) { genre_checkboxes_screen_w = document.body.clientWidth; //genre_checkboxes_URL = "ctv_video.php?screen_width=" + genre_checkboxes_screen_w + "&mode=searchadvanced"; //genre_checkboxes_URL = "ctv_video.php?mode=searchadvanced&screen_width=" + genre_checkboxes_screen_w; genre_checkboxes_URL = url + "&screen_width=" + genre_checkboxes_screen_w; location.href = genre_checkboxes_URL; } ///////////////////////////////////////////// // selectDeselectCheckboxesAll // ///////////////////////////////////////////// function selectDeselectCheckboxesAll( checkbox_object, form_name ) { for( var i=0; i < document.forms[form_name].elements.length; i++ ) { if( document.forms[form_name].elements[i].type == 'checkbox' ) { document.forms[form_name].elements[i].checked = checkbox_object.checked; } } } function selectDeselectCheckboxesMarketSpecific( checkbox_object, checkbox_name ) { if( checkbox_name == "national" ) { // } //else if( checkbox_name == "local" && checkbox_object.checked ) else if( checkbox_name == "local" ) { document.forms["search_form"].market_ny_selected.checked = checkbox_object.checked; document.forms["search_form"].market_la_selected.checked = checkbox_object.checked; document.forms["search_form"].market_chicago_selected.checked = checkbox_object.checked; document.forms["search_form"].market_phil_selected.checked = checkbox_object.checked; document.forms["search_form"].market_boston_selected.checked = checkbox_object.checked; /// document.forms["search_form"].market_sf_selected.checked = checkbox_object.checked; document.forms["search_form"].market_dallas_selected.checked = checkbox_object.checked; document.forms["search_form"].market_dc_selected.checked = checkbox_object.checked; document.forms["search_form"].market_atlanta_selected.checked = checkbox_object.checked; document.forms["search_form"].market_detroit_selected.checked = checkbox_object.checked; /// document.forms["search_form"].market_houston_selected.checked = checkbox_object.checked; document.forms["search_form"].market_seattle_selected.checked = checkbox_object.checked; document.forms["search_form"].market_tampa_selected.checked = checkbox_object.checked; document.forms["search_form"].market_minneapolis_selected.checked = checkbox_object.checked; document.forms["search_form"].market_phoenix_selected.checked = checkbox_object.checked; /// document.forms["search_form"].markets_top_5_selected.checked = checkbox_object.checked; document.forms["search_form"].markets_top_10_selected.checked = checkbox_object.checked; document.forms["search_form"].markets_top_25_selected.checked = checkbox_object.checked; /// document.forms["search_form"].markets_26_50_selected.checked = checkbox_object.checked; document.forms["search_form"].markets_51_75_selected.checked = checkbox_object.checked; document.forms["search_form"].markets_76_100_selected.checked = checkbox_object.checked; document.forms["search_form"].markets_100_plus_selected.checked = checkbox_object.checked; } //else if( checkbox_name == "markets_top_5" && checkbox_object.checked ) else if( checkbox_name == "markets_top_5" ) { document.forms["search_form"].market_ny_selected.checked = checkbox_object.checked; document.forms["search_form"].market_la_selected.checked = checkbox_object.checked; document.forms["search_form"].market_chicago_selected.checked = checkbox_object.checked; document.forms["search_form"].market_phil_selected.checked = checkbox_object.checked; document.forms["search_form"].market_boston_selected.checked = checkbox_object.checked; } //else if( checkbox_name == "markets_top_10" && checkbox_object.checked ) else if( checkbox_name == "markets_top_10" ) { document.forms["search_form"].market_ny_selected.checked = checkbox_object.checked; document.forms["search_form"].market_la_selected.checked = checkbox_object.checked; document.forms["search_form"].market_chicago_selected.checked = checkbox_object.checked; document.forms["search_form"].market_phil_selected.checked = checkbox_object.checked; document.forms["search_form"].market_boston_selected.checked = checkbox_object.checked; /// document.forms["search_form"].market_sf_selected.checked = checkbox_object.checked; document.forms["search_form"].market_dallas_selected.checked = checkbox_object.checked; document.forms["search_form"].market_dc_selected.checked = checkbox_object.checked; document.forms["search_form"].market_atlanta_selected.checked = checkbox_object.checked; document.forms["search_form"].market_detroit_selected.checked = checkbox_object.checked; } //else if( checkbox_name == "markets_top_25" && checkbox_object.checked ) else if( checkbox_name == "markets_top_25" ) { document.forms["search_form"].market_ny_selected.checked = checkbox_object.checked; document.forms["search_form"].market_la_selected.checked = checkbox_object.checked; document.forms["search_form"].market_chicago_selected.checked = checkbox_object.checked; document.forms["search_form"].market_phil_selected.checked = checkbox_object.checked; document.forms["search_form"].market_boston_selected.checked = checkbox_object.checked; /// document.forms["search_form"].market_sf_selected.checked = checkbox_object.checked; document.forms["search_form"].market_dallas_selected.checked = checkbox_object.checked; document.forms["search_form"].market_dc_selected.checked = checkbox_object.checked; document.forms["search_form"].market_atlanta_selected.checked = checkbox_object.checked; document.forms["search_form"].market_detroit_selected.checked = checkbox_object.checked; /// document.forms["search_form"].market_houston_selected.checked = checkbox_object.checked; document.forms["search_form"].market_seattle_selected.checked = checkbox_object.checked; document.forms["search_form"].market_tampa_selected.checked = checkbox_object.checked; document.forms["search_form"].market_minneapolis_selected.checked = checkbox_object.checked; document.forms["search_form"].market_phoenix_selected.checked = checkbox_object.checked; } } //network_class is id of main toggle, class of children. //$ is prototype function to lookup element by id. //$$ is prototype to lookup by class. function toggleNetwork(network_class) { var state = $(network_class).checked; var boxesToToggle = $$("input."+network_class); for(var i = 0; i