/* * Name: * stats_tracker.js * * Description: * * * Pre-conditions: * * Post-conditions: * * Libraries: * - createStatCookie , readStatCookie , eraseStatCookie functions are defined into * docrootx/javascript/global_functions.js * * Log: * Prajapati Nilesh 07 May 2008 * - Creation * */ var d=document; var popOver = true; //to allow pop UP or pop OVER (in div with iframe external file) var podClick = false; var tracker = false; //ajaxArray = new Array(); var sIndex = 0; debugStr = true; //this is used for to show the response into test page from ajax //and for this we need one
into the test page var siteUrl = window.location.hostname; //www.itm2093.com this will also give same. var clicktracker_url = "/statistics/stats_tracker.php"; var demographic_url = '/survey.php'; var demographic_url_iframe = '/statistics/survey_iframe.php'; //-------------------------- For full file url path -------------------------- // // Commented this one becasue sometime trackDbStnUrl = www.itm2093.com and we are surfing site using itm2093.com // so, it will make problem // if (trackDbStnUrl && trackDbStnUrl != 'undefined') { //clicktracker_url = "http://"+trackDbStnUrl+clicktracker_url; //www.itm2093.com //demographic_url = "http://"+trackDbStnUrl+demographic_url; } if (siteUrl && siteUrl != 'undefined') { clicktracker_url = "http://"+siteUrl+clicktracker_url; //www.itm2093.com demographic_url = "http://"+siteUrl+demographic_url; if (popOver && popOver != 'undefined') { //demographic_url = '/survey.php'; //it will take current parent hostname demographic_url_iframe = "http://"+siteUrl+demographic_url_iframe; } } //------------------------------------ var clicktracker_domains = Array(""); //var clicktracker_extensions = Array("doc", "exe", "rar", "zip"); var clicktracker_extensions = Array(""); //*****This same is in global_functions.js file. but if it will not get from there than it will use here************* function function_exists( function_name ) { if (typeof function_name == 'string') { return (typeof window[function_name] == 'function'); } else { return (function_name instanceof Function); } }//End of function function_exists /* * Name: * createStatCookie * * Description: * writes a cookie on the client's computer * * Preconditions: * - name: name of the cookie that will hold the value * - value: the value to be stored in the cookie * * Postconditions: * - the cookie is written * * Functions: * - None * * Log: * Nilesh Prajapati 23 May 2008 * - Creation * */ if (!function_exists('createStatCookie')) { function createStatCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; }// End function = createStatCookie } /* * Name: * readStatCookie * * Description: * read a cookie from the client's computer * * Preconditions: * - key: name of the cookie that holds the value * * Postconditions: * - the cookie value is returned if it exists, otherwise null is returned * * Functions: * - None * * Log: * Nilesh Prajapati 23 May 2008 * - Creation * */ if (!function_exists('readStatCookie')) { function readStatCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; }// End function - readStatCookie } /* * Name: * eraseStatCookie * Log: * Nilesh Prajapati 23 May 2008 * - Creation */ if (!function_exists('eraseStatCookie')) { function eraseStatCookie(name) { createStatCookie(name,"",-1); }//End of function eraseStatCookie } // ***** clicktracker_inarray ***** function clicktracker_inarray(arr, val) { for (var i in arr) if (arr[i] == val) return true; return false; }//End of function clicktracker_inarray // ***** clicktracker_innerText ***** function clicktracker_innerText(str) { str = str.replace(/<[^>]*>/g, ' '); str = str.replace(/ /g, ' '); str = str.replace(/^\s+/g, ''); str = str.replace(/\s+$/g, ''); return str; }//End of function clicktracker_innerText // ***** URL ******************************************************************* var clicktracker_re_scheme = "^\\w+://"; var clicktracker_re_folder = "((?:-|\\w|\\.)*)"; var clicktracker_re_domain = clicktracker_re_scheme+ clicktracker_re_folder; var clicktracker_re_folders = clicktracker_re_domain+"(?:/"+clicktracker_re_folder+')*'; // ***** clicktracker_domain ***** function clicktracker_domain(url) { var reg = new RegExp(clicktracker_re_domain); var match = reg.exec(url); if (!match) return ""; match = match[match.length-1]; return match; }//End of function clicktracker_domain // ***** clicktracker_extension ***** function clicktracker_extension(url) { var reg = new RegExp(clicktracker_re_folders); var match = reg.exec(url); if (!match) return ""; match = match[match.length-1].split("."); return (match.length >= 2) ? match[match.length-1] : ""; }//End of function clicktracker_extension // ***** Track ***************************************************************** // ***** clicktracker_aux ***** // here: url -> means the link contains into the anchor tag during click // title -> means the text showing (lable) of anchor tag. // function clicktracker_aux(url, title, linkObj) { extraParam = 'clicked=true&'; //this will identify whether we click to any link on page or not. // // This will contains the actual page URL on which links are available to click. // //var page_URL = url; //it will get the current visited url link var page_URL = escape(d.URL); if (page_URL) { extraParam += 'refPage='+page_URL+'&'; // get the referral Page means actual page link. } queryParam = createQueryStringForStnPageInfo('click'); //it will get the value of stnPageId. because we have passed flag=click extraParam += queryParam; // // For to get the station box id and stn page column id // resultArr = getStnBoxInfoOnClick(tagObj); stnBoxIdVal = resultArr['stnBoxId']; stnPageColumnIdVal = resultArr['stnPageColumnId']; contentIdVal = resultArr['contentId']; contentTypeIdVal = resultArr['contentTypeId']; groupIdVal = resultArr['groupId']; if (stnBoxIdVal && stnPageColumnIdVal) { extraParam += 'sBI='+stnBoxIdVal+'&'; extraParam += 'sPCI='+stnPageColumnIdVal+'&'; } if (contentIdVal && contentTypeIdVal) { extraParam += 'cNId='+contentIdVal+'&'; extraParam += 'cNTId='+contentTypeIdVal+'&'; extraParam += 'grpId='+groupIdVal+'&'; } //----------For ITunes button click first it will go to rss file and from that enclose url will give actual itunes url------ // // it will get value on the onclick of button of itunes from the hidden variable "trackPodcastIndividual" // which we defined into the recent_episode.lib file. // episodeIdVal = resultArr['episodeId'] podcastItemIdVal = resultArr['podcastItemId']; if (episodeIdVal) { extraParam += 'epId='+episodeIdVal+'&'; extraParam += 'pIId='+podcastItemIdVal+'&'; //for some episode podCastItemId might be 0 // // if we donot allowd this iTunes from here means at the same page itunes button than comment this code. // added false to not allow to insert the records of 4th button podcast rss into ItunesTrack table. // right now no need to open this code so, it will add the value into the StatClick table only /*if(isITunesURL(url) && false) { //if it will find this iTunes=true than it will insert into the "ItunesTrack" table extraParam += 'iTunes=true&'; }*/ // // this is for when we will click podcast button because now we have to store first record into the podCastStatUser table // and than statClick table. // buttonClick = getPodCastTrackInfo(url); if(buttonClick) { extraParam += 'btn='+buttonClick+'&'; podClick = true; } }//End of condition if (episodeIdVal) //------------------------------- // // At the time of click any button // if (trackStatsAllow && trackStatsAllow != 'undefined') { if(podClick) { tracker = false; //stop podcast tracking from here... because now we have direct code in particular file like sybase podcast tracking //because of 3rd party js error problem for VX-2565 } else { extraParam += 'trackAllow=true&'; tracker = true; } } else if (trackDragDropAllow && trackDragDropAllow != 'undefined') { extraParam += 'trackAllow=false&'; tracker = true; } else if(podClick) { extraParam += 'trackAllow=false&trackDragDrop=false&'; //tracker = true; tracker = false; //added here false to stop the podcast tracking from the js code //and allow it from the particular file calling..... //like episode_download.php file. } paramArr = new Array(); paramArr['allowRF'] = 0; //here put the 0 because we are getting it above "refPage=" queryStr = getJSClientInfo(paramArr); // if we want other information related to browser. //other than we can get this information from the $_SERVER things. //to decrease the length of the get query string. if (!debugStr) { //send request using Image var img = new Image(); img.src = clicktracker_url+"?"+extraParam+"url="+url+"&title="+title+"&rand="+Math.random()+queryStr; } else if(tracker) { //sending request using ajax // // This is for just debug whole output to main sample file. // fullURL = clicktracker_url+"?"+extraParam+"url="+url+"&title="+title+"&rand="+Math.random()+queryStr; //displayUrlInformation(fullURL); showHintAjax(fullURL); } }//End of function clicktracker_aux function getPodCastTrackInfo(url) { if (url && url != 'undefined') { url= unescape(url); if(url.match(/\/podcast\//)) { return 'rss'; //itpc://www.1010wins.com/pages/podcast/8888.rss } else if(url.match(/itpc:/)) { return 'rss'; //for external link: "itpc://feeds.tarot.com/f/ws/astrology/horoscope/daily/?partner=khits&key=8b30efa44850b8d1&type=rss" } else if (url.match(/type=rss/)) { return 'rss'; //for external link: } else if(url.match(/openPlayer/)) { return 'play'; } else if(url.match(/episode_download.php/)) { return 'download'; } else if(url.match(/podcast_chooser.php/)) { //http://imgsrv.1010wins.com/image/wins/box_imgs/FeatureGroup/podcast_button.gif return 'subscribe'; } else if(url.match(/openSubscribeWindow/)) { return 'subscribe'; } } return ''; }//End of function getPodCastTrackInfo // // Made the seperate function for iTunes // so, it will not make any problem with click the link. // function clickitunestracker_aux(url, title, linkObj) { extraParam = 'iTunes=true&'; //this will identify whether we click to any link on page or not. // // This will contains the actual page URL on which links are available to click. // //var page_URL = url; //it will get the current visited url link var page_URL = escape(d.URL); if (page_URL) { extraParam += 'refPage='+page_URL+'&'; // get the referral Page means actual page link. } audioFileUrl = getAudioFileUrl(url); if(audioFileUrl) { extraParam += 'audUrl='+audioFileUrl+'&'; } paramArr = new Array(); paramArr['allowRF'] = 0; //here put the 0 because we are getting it above "refPage=" queryStr = getJSClientInfo(paramArr); // if we want other information related to browser. //other than we can get this information from the $_SERVER things. //to decrease the length of the get query string. if (!debugStr) { var img = new Image(); img.src = clicktracker_url+"?"+extraParam+"url="+url+"&title="+title+"&rand="+Math.random()+queryStr; } else { // // This is for just debug whole output to main sample file. // fullURL = clicktracker_url+"?"+extraParam+"url="+url+"&title="+title+"&rand="+Math.random()+queryStr; showHintAjax(fullURL); } }//End of function clickitunestracker_aux // // check the whether the .rss url of button is for itunes or not. // function isITunesURL(url) { //from recent_episodes.lib file. //itpc://www.itm2093.com/pages/podcast/33577.rss if (url && url != 'undefined') { if(url.match(/\/podcast\//)) { //if it will find podcast folder return true; } } return false; }//End of function isITunesURL function getAudioFileUrl(urlVal) { //http://itm2093.com/podcast_track.mp3?url=http://podcast.wcbs880.com/wcbs/1115484.mp3&statUserId=&demoUserId= //for to get the value from the url. //regex = /http:\/\/[a-z0-9]+\.[a-z0-9]+\.[a-z]{3}\/[a-z]+\/[0-9]+\.[a-z0-9]+/ig; //regex = /url=.+\&/ig; //regex = /=(http|https|ftp):\/\/.+\/.+\.(mp3|rm)+/ig; regex = /=(http|https|ftp):\/\/.+\/.+\.[a-z0-9]+/ig; //if escaped value than unescaped it here urlVal = unescape(urlVal); if (urlVal.match(regex)) { audioUrl = RegExp['$&']; audioUrl = audioUrl.substr(1, audioUrl.length); //if we will use regx with = http: than only needed return escape(audioUrl); } else { return ''; } }//End of function getAudioFileUrl function redirectToAudioUrl() { var page_URL = escape(d.URL); audioFileUrl = getAudioFileUrl(page_URL); if(audioFileUrl) { audioFileUrl = unescape(audioFileUrl); window.location = audioFileUrl; return true; } return false; }//End of function redirectToAudioUrl // ***** clicktracker ***** function itunesTracker(e) { var ie = navigator.appName == "Microsoft Internet Explorer"; var src = ie ? window.event.srcElement : e.target; var tag = (src.tagName.toLowerCase() != "a") ? src.parentNode : src; eltTag = tag.tagName; eltTag = (eltTag) ? eltTag.toLowerCase() : ''; if (!tag || eltTag != "a") return; domain = clicktracker_domain (tag.href); extension = clicktracker_extension(tag.href); if ( clicktracker_inarray(clicktracker_domains, domain) && !clicktracker_inarray(clicktracker_extensions, extension)) return; var url = tag.href; var title = ''; if (!title) if (tag.tagName.toLowerCase() == "a") title = clicktracker_innerText(tag.innerHTML); if (!title) if (tag.tagName.toLowerCase() == "a") title = clicktracker_innerText(tag.title); if (!title) if (src.tagName.toLowerCase() == "img") title = clicktracker_innerText(src.alt); if (!title) if (src.tagName.toLowerCase() == "img") title = clicktracker_innerText("Image"); // // This is for close link , and didnot allow it into database for to store. // Close // if (url) { if(url.toLowerCase() == 'javascript:void(0);' || url.toLowerCase() == 'javascript:void(0)') { url = ''; if (tag.onclick) { url = tag.onclick; } if(title && title != 'undefined') { if (title.toLowerCase() == 'close') { url = ''; } } } }//End of if (url) url = escape(url); title = escape(title.substr(0, 150)); tagObj = tag; if (url && title) setTimeout("clickitunestracker_aux('"+url+"', '"+title+"' , tagObj)", 10); return; }//End of function itunesTracker // // This function will call when we click on any link of the page. // var previousLinkVal = ''; function clicktracker(e) { //evt = (e) ? e : window.event; //Start check if event button 2 is clicked or not. //right click of mouse //if(evt.button == 2){ //}//End check if event button 2 is clicked or not. // Detect issuing element. //var srcElt = (e.target) ? e.target : e.srcElement; /*var eltId; var eltTag; var eltType; // Obtain Information about the sending element. means delete this item button on property window eltId = srcElt.id; eltTag = srcElt.tagName.toLowerCase(); eltType = srcElt.type;*/ var ie = navigator.appName == "Microsoft Internet Explorer"; var src = ie ? window.event.srcElement : e.target; var tag = (src.tagName.toLowerCase() != "a") ? src.parentNode : src; eltTag = tag.tagName; eltTag = (eltTag) ? eltTag.toLowerCase() : ''; //if (!tag || tag.tagName.toLowerCase() != "a") return; if (!tag || eltTag != "a") return; domain = clicktracker_domain (tag.href); extension = clicktracker_extension(tag.href); if ( clicktracker_inarray(clicktracker_domains, domain) && !clicktracker_inarray(clicktracker_extensions, extension)) return; var url = tag.href; var title = ''; if (!title) if (tag.tagName.toLowerCase() == "a") title = clicktracker_innerText(tag.innerHTML); if (!title) if (tag.tagName.toLowerCase() == "a") title = clicktracker_innerText(tag.title); if (!title) if (src.tagName.toLowerCase() == "img") title = clicktracker_innerText(src.alt); if (!title) if (src.tagName.toLowerCase() == "img") title = clicktracker_innerText("Image"); // // This is for close link , and didnot allow it into database for to store. // Close // if (url) { if (popOver && popOver != 'undefined') { var urlOnclick = ''; if (tag.onclick) { urlOnclick = tag.onclick } //var myRegExp = /close/; //var matchPos1 = url.search(myRegExp); if (urlOnclick) { idLink = tag.id; if (idLink && idLink != 'undefined') { if (idLink == 'closeIframeLink') { return; } } /*var myRegExp = /hideIFramePanel/; var matchPos1 = urlOnclick.search(myRegExp); if(matchPos1 != -1) { alert("There was a match at position " + matchPos1); return; } else { alert("There was no match in the first string"); }*/ } }//End of condition if (popOver && popOver != 'undefined') if(url.toLowerCase() == 'javascript:void(0);' || url.toLowerCase() == 'javascript:void(0)') { url = ''; //this is for to allow insertion of records if there is external link on to feature group to open into new window. if (tag.onclick) { url = tag.onclick; } if(title && title != 'undefined') { if (title.toLowerCase() == 'close') { url = ''; } } } }//End of if (url) //url = escape(url .substr(0, 150)); url = escape(url); title = escape(title.substr(0, 150)); tagObj = tag; //here tag is the anchor tag object //tag.href // // trackDemoGraphInfomation you will get it from the create_stn_page.php file. // and this whole above function will called during click only. // if (trackDemoGraphInfomation && trackDemoGraphInfomation != 'undefined') { demoGraphInfoArray = trackDemoGraphInfomation.split('-'); isActive = parseInt(demoGraphInfoArray[0]); //means 1 clickNo = parseInt(demoGraphInfoArray[1]); skippedHour = parseInt(demoGraphInfoArray[2]); if (clickNo > 0) { clickNo = clickNo - 1; //for on exect click no popup should open. } else { clickNo = ''; } //alert(isActive + ' -- ' + clickNo + ' -- ' + demographic_url); if (isActive && isActive > 0) { var noOfLinkClickCookieVal = readStatCookie('noOfLinkClick'); //noOfLinkClickCookieVal = 1000; var skippedHourCookieVal = readStatCookie('skippedHour'); //if (noOfLinkClickCookieVal == clickNo && (skippedHourCookieVal == 'null' || skippedHourCookieVal == null || skippedHourCookieVal == '' ) ) { if (noOfLinkClickCookieVal == clickNo) { previousLinkVal = escape(tagObj.onclick); tagObj.onclick = function () { return false; } //tagObj.onclick = 'return false;'; //tagObj.addEventListener('click', function () { return false; } , true); //check with false param at last arg if (popOver && popOver != 'undefined') { openPopOver(); } else { openPopup(); } setTimeout("setLinkUrlAgain('"+previousLinkVal+"', tagObj)", 2000); return false; }//End of if (noOfLinkClickCookieVal == clickNo) }//End of condition if (isActive && isActive > 0) }//End of condition if (trackDemoGraphInfomation && trackDemoGraphInfomation != 'undefined') if (url && title) setTimeout("clicktracker_aux('"+url+"', '"+title+"' , tagObj)", 10); return; }//End of function clicktracker function setLinkUrlAgain(url , tagObj) { if (url && url != 'undefined') { tagObj.onclick = url; } else { tagObj.onclick = ''; } }//End of function setLinkUrlAgain // ***** Attach Events ********************************************************* //this onclick will set at the last of page load from the create_stn_page.php file. //to avoid the dublicate entry on single click. because in our case we have .js multiple times into single page. // // in the http://www.itm2093.com/podcast_track.php we have trackItunes=true while setOnClick=flase; // if (trackItunes && trackItunes != 'undefined') { if (navigator.appName == "Microsoft Internet Explorer") { //document.attachEvent('onclick', itunesTracker); //document.attachEvent("oncontextmenu", itunesTracker); //right click document.attachEvent("onmousedown", itunesTracker); } else { document.addEventListener('click', itunesTracker, true); } } if (setOnClick && setOnClick != 'undefined') { if (navigator.appName == "Microsoft Internet Explorer") { //If we open the link in the tab (clicking mouse wheel or open in new window using right //mouse click and chossing in option which is general tendency now days to open the click) //the clicks are not registered i had this problem in IE7 //document.attachEvent ('onclick', clicktracker); //document.attachEvent("oncontextmenu", clicktracker); //right click document.attachEvent("onmousedown", clicktracker); } else { //document.addEventListener('click', clicktracker, false); document.addEventListener('click', clicktracker, true); //because now we used tagObj.onclick during isActive checking } } //***** For to track the page view ************************************************ // // This function will call during the page loading // At this time visitPage and referralPage both are same. // and we will not get value of clicked=true. because this will called directly during page load. // function getVisitedUrlInfo(infoArray,reqIndex) { var extraParam = ''; var queryStr = ''; var queryParam = ''; var page_URL = escape(d.URL); //it will get the current visited url link var page_Title = escape(d.title); //it will get the page title if (!page_Title) { page_Title = 'NoPageTitle'; } // // if it is true than only need to add into statView table // if (trackStatsAllow && trackStatsAllow != 'undefined') { queryParam = createQueryStringForStnPageInfo('view',infoArray); extraParam = queryParam; extraParam += '&trackAllow=true&'; paramArr = new Array(); paramArr['allowRF'] = 1; queryStr = getJSClientInfo(paramArr); //we can get this information from the $_SERVER to reduce the length of get query string tracker = true; } //here trackDragDrop is true. else if (trackDragDropAllow && trackDragDropAllow != 'undefined') { //this will helpful during drag and drop things where we need only statUserId even if statVisitor allow set to false. //and at the time of podcast tracking because in old podcast tracking we donot have statVisitor allow true/false option at backend side. extraParam = 'createStatUser=true&trackAllow=false&'; //only need to add the statUserId in cookie tracker = true; //here we need because we are creating the statUserId first time from the stats_tracker.php file and after //creating we are updating its last time in StatUser table. } else { //only allow podcast things means four button but without statUserId creation means if in cookie than it will store otherwise it will take 0 extraParam = 'trackAllow=false&trackDragDrop=false&'; tracker = false; //no need to send the request to server means site_traker.php file at the time of view. if both are false } if (!debugStr) { var img = new Image(); img.src = clicktracker_url+"?"+extraParam+"url="+page_URL+"&title="+page_Title+"&rand="+Math.random()+queryStr; } else if (tracker) { // // This is for just debug whole output to main sample file. // fullURL = clicktracker_url+"?"+extraParam+"url="+page_URL+"&title="+page_Title+"&rand="+Math.random()+queryStr; //displayUrlInformation(fullURL); if (reqIndex >= 0) { showHintAjax_Multiple(fullURL,reqIndex); } else { showHintAjax(fullURL); } } // // This is to pass the stmBoxId and stnPageColumnId into the current url for view. // //appendStnBoxInfoToLinks(); }//End of function getVisitedUrlInfo function dumpFunction() { var statUserIdCookieVal = readStatCookie('statUserId'); if (statUserIdCookieVal && statUserIdCookieVal != 'undefined') { // // if cookie of statUserId is set properly during getVisitedUrlInfo() for whole stnPageInfo than only // need to allow to add the information for trackArray things. for(x in trackArray) { arrayVal = trackArray[x]; getVisitedUrlInfo(arrayVal,x); //setTimeout('getVisitedUrlInfo(arrayVal,x)',1); } } else { setTimeout('dumpFunction()',1); } }//End of function dumpFunction // // this function call during page load of podcast_track.php file // because in that we have set trackItunes = true and setOnClick = false; // function getVisitedPodCastUrlInfo() { var extraParam = ''; extraParam = 'iTunes=true&'; //at the time of view or click of podcast_track.php file it will set iTunes=true var queryStr = ''; var queryParam = ''; var page_URL = escape(d.URL); //it will get the current visited url link var page_Title = escape(d.title); //it will get the page title if (!page_Title) { page_Title = 'NoPageTitle'; } audioFileUrl = getAudioFileUrl(page_URL); if(audioFileUrl) { extraParam += 'audUrl='+audioFileUrl+'&'; } paramArr = new Array(); paramArr['allowRF'] = 1; queryStr = getJSClientInfo(paramArr); //we can get this information from the $_SERVER to reduce the length of get query string if (!debugStr) { var img = new Image(); img.src = clicktracker_url+"?"+extraParam+"url="+page_URL+"&title="+page_Title+"&rand="+Math.random()+queryStr; } else { fullURL = clicktracker_url+"?"+extraParam+"url="+page_URL+"&title="+page_Title+"&rand="+Math.random()+queryStr; showHintAjax(fullURL); } }//End of function getVisitedPodCastUrlInfo //trackItunes= flase into the create_stn_page.php file if (trackItunes && trackItunes != 'undefined') { //if it will get trackItunes=true from the stationUrl/podcast_track.php file than no need to add entry into the StatView table. getVisitedPodCastUrlInfo(); //during loading of podcast_track.php file this function will called } else { // // This is for to store station page //setTimeout('getVisitedUrlInfo()',1); // This function is used to track the view during page load of page getVisitedUrlInfo(); } // // trackArray will get the value from the feature_group.lib file. // if (trackStatsAllow && trackStatsAllow != 'undefined') { if (trackArray && trackArray != 'undefined') { // // For first request upto cookie is not set no need to allow called getVisitedUrlInfo funcation for trackArray // setTimeout('dumpFunction()',1); /* //for checking multiple records. infoArray = new Array(); infoArray['trackDbInfo'] = "70111-64158-2"; infoArray['trackContentInfo'] = "66825-4-9811-91856,91852"; try{ trackArray[trackArray.length] = infoArray; }catch(e){}*/ }//End of condition if (trackArray && trackArray != 'undefined') } var skippedHourVal; // // Function for to open the popup automatically after the no of hour set from the backend. // function checkCookie() { demoUserIdVal = readStatCookie('demoUserId'); if (demoUserIdVal && demoUserIdVal != 'undefined') { //if demo user Id set than no need to open the popup //means particular user already set the response for the demographic popup. } else { var date = new Date(); current_hour = date.getHours(); //Number of hours (0-23) current_day = date.getDate(); current_month = date.getMonth(); current_year = date.getFullYear(); checkVal = current_month+'/'+current_day+'/'+current_year+':'+current_hour; skippedHourVal = readStatCookie('skippedHour'); currentDateInfoArray = new Array(); skippedDateInfoArray = new Array(); if (checkVal && skippedHourVal) { currentDateInfoArray = checkVal.split(':'); skippedDateInfoArray = skippedHourVal.split(':'); } if(skippedHourVal == checkVal) { //excet time popup will open. if (popOver && popOver != 'undefined') { openPopOver(); } else { openPopup(); } }else{ // // if current date greater than cookie set date and popup will not open than need to open popup directly. // if (currentDateInfoArray && skippedDateInfoArray) { if( (Date.parse(currentDateInfoArray[0]) >= Date.parse(skippedDateInfoArray[0])) && ( parseInt(currentDateInfoArray[1]) > parseInt(skippedDateInfoArray[1]) ) ) { if (popOver && popOver != 'undefined') { openPopOver(); } else { openPopup(); } } else { window.setTimeout( "checkCookie()", 1000); } } else { window.setTimeout( "checkCookie()", 1000); } }//End of condition if(skippedHourVal == checkVal) }//End of condition if (demoUserIdVal && demoUserIdVal != 'undefined') }//End of function checkCookie function openPopup() { var demoOpenedCookieVal = readStatCookie('demoOpened'); if (demoOpenedCookieVal == 1 && demoOpenedCookieVal != 'undefined') { //to avod the opening of the demo popup as many tab or pages open of intertech site.. after some specific time //because pages are checking the time to open the popup demographic user and all have its own childs. } else { createStatCookie('demoOpened',1,3650); window.open(demographic_url,'DemoGraphPopup','height=450,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes'); } }//End of function openPopup function openPopOver() { //using light window window script.. defined into create_stn_page.php file..... //myLightWindow.createWindow(tagObj); exampleCreated = true; //myLightWindow.activateWindow({href: 'http://stickmanlabs.com/images/kevin_vegas.jpg', title: 'Waiting for the show to start in Las Vegas', author: 'Jazzmatt', caption: 'Mmmmmm Margaritas! And yes, this is me...', left: 300}); //directly putting iframe inside the create_stn_page.php file.... if (window.frames["popupIframe"] && window.frames["popupIframe"] != 'undefined') { inputParam = new Array(); inputParam['iframeName'] = 'popupIframe'; //name and id should be same inputParam['iframeObj'] = window.frames["popupIframe"]; inputParam['iframeWidth'] = 360; inputParam['iframeHeight'] = 490; inputParam['iframeURL'] = demographic_url; inBuiltIframeCall(inputParam); } //demographic_url = 'http://'+ document.domain +demographic_url; //alert(demographic_url); //callToServer(demographic_url,360,490,false); //dynamic iframe generation //alert(demographic_url_iframe); //callToServer(demographic_url_iframe,360,490,true); }//End of function openPopOver checkCookie(); //***** get all client info using js ************************************************ function getJSClientInfo(paramArr) { var pageQueryStr = ''; //var page_URL = d.URL; //it will get the current visited url link //var page_Title = d.title; //it will get the page title //document.body.clientWidth or window.innerWidth //window.onresize=new Function("resizeDiv()"); var t = new Date(); //var pageQueryStr="http"+(d.URL.indexOf('https:')==0?'s':'')+"://siteURLHere.com/fileName.php?param1=val1¶m2="+val2; //if we click any link of the page than we donot need this extra things in get url to decrease the size of get url //so, during clicktracker_aux function i am passing it as flase. if (paramArr['allowRF']) { // // we need to get the referrer page using javascript // because $_SERVER['HTTP_REFERER'] will not help us to get the referrer url things if we comes from the google. // pageQueryStr += "&rf="+escape(parent == self ? d.referrer : top.d.referrer); //alert(window.opener.location); //it is giving error Location.toString //alert(window.opener.location.href); /*if (d.referrer || top.d.referrer) { //if not find this way than we will go for else condition } else { //Right Now we donot need it later we will check //this is for IE.. and in special case like //Our Station Page //means we are opning the our page into the new window using window.open method if (window.opener && window.opener != 'undefined') pageQueryStr += "&rf="+escape(window.opener.location); }*/ }//End of condition if (paramArr['allowRF']) pageQueryStr += "&tz="+escape(t.getTimezoneOffset()); pageQueryStr += "&ch="+escape(t.getHours()); pageQueryStr += "&ul="+escape(navigator.appName=="Netscape" ? navigator.language : navigator.userLanguage); if(typeof(screen)=="object") { pageQueryStr += "&sr="+screen.width+"x"+screen.height; pageQueryStr += "&cd="+screen.colorDepth; pageQueryStr += "&jo="+(navigator.javaEnabled() ? "Yes" : "No"); } //alert(navigator.appVersion + ' -- ' + navigator.userAgent); //this same we can get from the $_SERVER['HTTP_USER_AGENT']; //right now stop it but donot delete it. //pageQueryStr += "&br="+detectBrowserType(); return pageQueryStr; }//End of function getJSClientInfo //***** get stnbox id and stn page column id from the link object ********************************* /* * Name: * getStnBoxInfoOnClick * * Description: * * Preconditions: * * Postconditions: * * Log: * Prajapati Nilesh 13 May 2008 * - Creation. */ function getStnBoxInfoOnClick(tagObj) { resultArr = new Array(); stnBoxId = 0; stnPageColumnId = 0; blurbIdVal = 0; contentIdVal = 0; contentTypeIdVal = 0; groupIdVal = 0; contentInfoIndividualVal = 0; podCastInfoIndividualVal = 0; resizeColumnDivObj = null; if (tagObj && tagObj != 'undefined') { //(tagObj.previousSibling.nodeName) var p = tagObj; /*while(1){ p = p.parentNode; if(!p || p.nodeType != 1){ break; }else{ alert(p.parentNode); } }*/ var isStnBoxId = false; var isContentInfo = false; var isPodcastInfo = false; //while(typeof(p.parentNode) == 'object' && p.parentNode) { while(typeof(p) == 'object' && p) { if (p && p != 'undefined') { eltTag = p.tagName; //p.nodeName eltTag = (eltTag) ? eltTag.toLowerCase() : ''; cssClassName = p.className; if (cssClassName && cssClassName != 'undefined' && !isStnBoxId) { splitArray = cssClassName.split('_'); boxLabel = splitArray[0]; //Box string contains here if (boxLabel.toLowerCase() == 'box') { stnBoxId = splitArray[1]; //Box_60777_Headline this is our class formate isStnBoxId = true; //break; //donot put break here because we need to search stnPageColumnId id also } } // // For to get individual information means featureInfo inside particular featureGroupId // if (eltTag == 'td' && !isContentInfo) { trackContentIndividualHiddenId = 'trackContentIndividual[]'; trackPodcastIndividualHiddenId = 'trackPodcastIndividual[]'; trackContentIndividualHiddenColl = p.getElementsByTagName('input'); for (eltIndex = trackContentIndividualHiddenColl.length - 1; eltIndex >= 0; eltIndex--) { currentElt = trackContentIndividualHiddenColl[eltIndex]; if (currentElt && currentElt != 'undefined') { //trackPodcastIndividual[] this should be first checking than the trackContentIndividual[] if (currentElt.type.toLowerCase() == 'hidden' && currentElt.id == trackPodcastIndividualHiddenId) { podCastInfoIndividualVal = currentElt.value; isPodcastInfo = true; //no need break here. } if (currentElt.type.toLowerCase() == 'hidden' && currentElt.id == trackContentIndividualHiddenId) { contentInfoIndividualVal = currentElt.value; isContentInfo = true; break; //only break this current loop of td. } } }//End of for loop }//End of condition if (eltTag == 'td') //for to find the stnPageColumnId from the // //
if (eltTag == 'div') { idDiv = p.id; if(idDiv.match(/resizeColumn/)) { stnPageColumnIdVal = parseInt(idDiv.replace(/[a-z]/gi,"")); if(stnPageColumnIdVal > 0) { stnPageColumnId = stnPageColumnIdVal resizeColumnDivObj = p; break; //if we will reach upto stnPageColumnId than just break the while loop. } } } p = p.parentNode; //if not found from the current object than check its parent node } else { break; //if p is not object than also break from the loop } }//End of condition while(typeof(p.parentNode) == 'object' && p.parentNode) /*do { //p = p.previousSibling; p = p.parentNode; alert(p.nodeType); } while (p && p.nodeType != 1);*/ }//End of condition if (tagObj && tagObj != 'undefined') resultArr['stnBoxId'] = stnBoxId; resultArr['stnPageColumnId'] = stnPageColumnId; // // For to get the contentInformation // trackContentHiddenObj = null; trackContentHiddenId = 'trackContent_'+stnPageColumnId+'-'+stnBoxId; if (resizeColumnDivObj && resizeColumnDivObj != 'undefined') { //trackContentHiddenObj = resizeColumnDivObj.getElementById(trackContentHiddenId); //this way it will not allow us. trackContentHiddenColl = resizeColumnDivObj.getElementsByTagName('input'); for (eltIndex = trackContentHiddenColl.length - 1; eltIndex >= 0; eltIndex--) { currentElt = trackContentHiddenColl[eltIndex]; if (currentElt && currentElt != 'undefined') { if (currentElt.type.toLowerCase() == 'hidden' && currentElt.id == trackContentHiddenId) { trackContentHiddenObj = currentElt; break; } } } } else { trackContentHiddenObj = document.getElementById(trackContentHiddenId); } if (trackContentHiddenObj && trackContentHiddenObj != 'undefined') { contentInfoStr = trackContentHiddenObj.value; if (contentInfoStr) { contentInfoArray = contentInfoStr.split('-'); blurbIdVal = contentInfoArray[0]; contentTypeIdVal = contentInfoArray[1]; groupIdVal = contentInfoArray[2]; contentIdVal = contentInfoArray[3]; } } //resultArr['contentId'] = contentIdVal; //comma sperator featureId contentIdIndividualVal = 0; groupIdIndividualVal = 0; contentTypeIdIndividualVal = 0; if (contentInfoIndividualVal) { contentInfoIndividualArray = contentInfoIndividualVal.split('-'); contentIdIndividualVal = contentInfoIndividualArray[3]; groupIdIndividualVal = contentInfoIndividualArray[2]; contentTypeIdIndividualVal = contentInfoIndividualArray[4]; } episodeIdVal = 0; podcastItemIdVal = 0; if (podCastInfoIndividualVal) { podCastInfoIndividualArray = podCastInfoIndividualVal.split('-'); episodeIdVal = podCastInfoIndividualArray[0]; podcastItemIdVal = podCastInfoIndividualArray[1]; } resultArr['episodeId'] = episodeIdVal; resultArr['podcastItemId'] = podcastItemIdVal; resultArr['contentId'] = contentIdIndividualVal; //this is individual means which feature is clicked that only resultArr['contentTypeId'] = contentTypeIdIndividualVal; //resultArr['contentTypeId'] = contentTypeIdVal; //resultArr['groupId'] = groupIdVal; //featureGroupId resultArr['groupId'] = groupIdIndividualVal; //because now we have individual group id for recent_episodes.lib and recent_program_episodes.lib file. return resultArr; }//End of function getStnBoxInfoOnClick //*** get stnbox id and stn page column id from the link object and than append it to links *** /* * Name: * appendStnBoxInfoToLinks * * Description: * This will append the stnBoxId and stnPageColumnId to each and every link present on the page * if it will get the stnBoxId and stnPageColumnId * Preconditions: * * Postconditions: * * Log: * Prajapati Nilesh 14 May 2008 * - Creation. */ function appendStnBoxInfoToLinks() { eltsList = document.getElementsByTagName('a'); for (eltIndex = eltsList.length - 1; eltIndex >= 0; eltIndex--) { currentElt = eltsList[eltIndex]; if (currentElt && currentElt != 'undefined') { tagObj = currentElt; var url = tagObj.href; resultArr = getStnBoxInfoOnClick(tagObj); stnBoxIdVal = resultArr['stnBoxId']; stnPageColumnIdVal = resultArr['stnPageColumnId']; // // This is to pass the stmBoxId and stnPageColumnId into the current url for view. // if (url && stnBoxIdVal && stnPageColumnIdVal) { linkUrl = tagObj.href; if (linkUrl.indexOf('?') > 0) { tagObj.href = linkUrl +'&vw=1&sBI='+stnBoxIdVal+'&sPCI='+stnPageColumnIdVal; } else { tagObj.href = linkUrl +'?vw=1&sBI='+stnBoxIdVal+'&sPCI='+stnPageColumnIdVal; } } }//End of condition if (currentElt && currentElt != 'undefined') }//End of for (eltIndex = eltsList.length - 1; eltIndex >= 0; eltIndex--) }//End of function appendStnBoxInfoToLinks /* * Name: * createQueryStringForStnPageInfo * * Description: * For this we need trackStnPageId and trackStnPageInfo[] both hidden into the station page. * so, for that i have changed below files. * docrootx/create_stn_page.php * docrootx/includes/stn_page_display_functions.lib * Benifit is we donot need to execute query again to get the things from php * Preconditions: * * Postconditions: * * Log: * Prajapati Nilesh 14 May 2008 * - Creation. */ function createQueryStringForStnPageInfo(falg,infoArray) { var queryParam = ''; // // get the stnPageId directly from the hidden instead of the using php code and seperate it from the URL. // //we can get this from the trackStnPageInfomation js varibale which defined into the create_stn_page.php file. trackStnPageIdObj = document.getElementById('trackStnPageId'); if (trackStnPageIdObj && trackStnPageIdObj != 'undefined') { trackStnPageIdVal = trackStnPageIdObj.value; if (trackStnPageIdVal) { queryParam += 'sPI='+trackStnPageIdVal+'&'; } } // trackDbInfoStr is the value like: stnPageColumnId_stnBoxId_boxTypeId from the feature_group.lib file. //this will get the value as per boxes only and for that we need to add this things into particular file //feature_group.lib file. var gotInfoArr = false; if (infoArray && infoArray != 'undefined') { trackDbInfoStr = infoArray['trackDbInfo']; trackContentInfoStr = infoArray['trackContentInfo']; gotInfoArr = true; } if (trackDbInfoStr && trackDbInfoStr != 'undefined' && falg == 'view') { stnInfoArray = trackDbInfoStr.split('-'); stnPageColumnId = stnInfoArray[0]; stnBoxId = stnInfoArray[1]; boxTypeId = stnInfoArray[2]; queryParam += 'sBI='+stnBoxId+'&'; queryParam += 'sPCI='+stnPageColumnId+'&'; } //$feaContentId.'-'.$feaContentType.'-'.$featureGroupId; for feature_group.lib file. if (trackContentInfoStr && trackContentInfoStr != 'undefined' && falg == 'view') { contentInfoArray = trackContentInfoStr.split('-'); blurbIdVal = contentInfoArray[0]; contentTypeIdVal = contentInfoArray[1]; groupIdVal = contentInfoArray[2]; // featureGroupId contentIdVal = contentInfoArray[3]; //comma sperator featureId queryParam += 'cNId='+contentIdVal+'&'; queryParam += 'cNTId='+contentTypeIdVal+'&'; queryParam += 'grpId='+groupIdVal+'&'; } // // For to track whole station page. and it will find into the create_stn_page.php file. // at last of page load it will defined . if (trackStnPageInfomation && trackStnPageInfomation != 'undefined' && falg == 'view' && !gotInfoArr) { //formate is like: stnPageId-contentType-contentId //here content id is the blurb id so, we donot need to store. stnPageInfoArray = trackStnPageInfomation.split('-'); stnPageIdVal = stnPageInfoArray[0]; contentTypeIdVal = stnPageInfoArray[1]; blurbIdVal = stnPageInfoArray[2]; queryParam = ''; queryParam += 'sPI='+stnPageIdVal+'&'; queryParam += 'cNId='+blurbIdVal+'&'; //At the time of page load means during whole page tracking contentId become blurbid. queryParam += 'cNTId='+contentTypeIdVal+'&'; } return queryParam; }//End of function createQueryStringForStnPageInfo /* * Name: * getAllStnBoxInfoArray * * Description: * * Preconditions: * * Postconditions: * * Log: * Prajapati Nilesh 16 May 2008 * - Creation. */ function getAllStnBoxInfoArray() { var queryParam = ''; // // ----------- For ALL BOXes Information from the whole page. -------------------------------------------- // //This hidden is defined into the stn_page_display_functions.lib file. //but for this method we need form tag and inside it we need to put that hidden //eltsList = getElement('trackStnPageInfo[]'); //in appx_functions.js file eltsList = getCollectionObjFromTagNameAndType(null,'input','hidden','trackStnPageInfo[]'); stnInfoArray = new Array(); commaSepStnBoxId = ''; commaSepStnPageColId = ''; tmpStnPageColId = 0; for (eltIndex = eltsList.length - 1; eltIndex >= 0; eltIndex--) { currentElt = eltsList[eltIndex]; stnInfoVal = currentElt.value; // 67742_60777_2 stnPageColumnId_stnBoxId_boxTypeId if (stnInfoVal) { stnInfoArray = stnInfoVal.split('_'); stnPageColumnId = stnInfoArray[0]; stnBoxId = stnInfoArray[1]; boxTypeId = stnInfoArray[2]; commaSepStnBoxId += stnBoxId+','; if (tmpStnPageColId != stnPageColumnId) { tmpStnPageColId = stnPageColumnId; commaSepStnPageColId += stnPageColumnId+','; } } }//End of for (eltIndex = eltsList.length - 1; eltIndex >= 0; eltIndex--) if (commaSepStnBoxId && commaSepStnPageColId) { //syntax of substr --: stringObject.substr(start,length) //remove last char from string //var strLen = commaSepStnBoxId.length; //commaSepStnBoxId = commaSepStnBoxId.slice(0,strLen-1); //or commaSepStnBoxId = commaSepStnBoxId.slice(0, -1); commaSepStnPageColId = commaSepStnPageColId.slice(0, -1); queryParam += 'sBI='+commaSepStnBoxId+'&'; queryParam += 'sPCI='+commaSepStnPageColId+'&'; } return queryParam; }//End of function getAllStnBoxInfoArray /* * Name: * getCollectionObjFromTagNameAndType -> we can use this function as global functions. * * Description: * based on the passed argument it will return the array or collection of object based on matching name * * Preconditions: * objInside - pass or option based on that it will search inside it or whole document * eltTagParam - tagname of control like: input , textarea etc.. * eltTypeParam - if type is there than only pass like for input - types are text,radio etc.. while textarea there is no type * searchFromName - based on passed search name it will take collection of group control * Postconditions: * return array with collection based on passed areguments. * Libraries: * * Log: * Prajapati Nilesh 14 May 2008 * - Creation * */ function getCollectionObjFromTagNameAndType(objInside,eltTagParam,eltTypeParam,searchFromName) { if (objInside && objInside != 'undefined') { //objInside means may be formObj or any object inside that element it will find other object eltsList = objInside.getElementsByTagName(eltTagParam); } else { //this is for whole document eltsList = document.getElementsByTagName(eltTagParam); } retArray = new Array(); for (eltIndex = eltsList.length - 1; eltIndex >= 0; eltIndex--) { currentElt = eltsList[eltIndex]; if (currentElt && currentElt != 'undefined') { var eltTag = currentElt.tagName; var eltType = currentElt.type; var eltName = currentElt.name; eltTag = (eltTag) ? eltTag.toLowerCase() : ''; eltType = (eltType) ? eltType.toLowerCase() : ''; //if eltTypeParam pass than based on that it will get the collection if (eltTypeParam && eltTypeParam != 'undefined') { if (eltTypeParam.toLowerCase() == eltType) { retArray = searchFromNameFun(retArray,searchFromName,eltName); } } else { retArray = searchFromNameFun(retArray,searchFromName,eltName); } }//End of condition if (currentElt && currentElt != 'undefined') }//End of for (eltIndex = eltsList.length - 1; eltIndex >= 0; eltIndex--) return retArray; }//End of function getCollectionObjFromTagNameAndType // // Part of above function getCollectionObjFromTagNameAndType // function searchFromNameFun(retArray,searchFromName,eltName) { if (searchFromName && searchFromName != 'undefined') { if (searchFromName == eltName) { retArray[retArray.length] = currentElt; } } else { //if searchFromName is not specified during calling of getCollectionObjFromTagNameAndType function retArray[retArray.length] = currentElt; } return retArray; }//End of condition searchFromNameFun //***** detect browser agent/type ******************************************* /* * Name: * detectBrowserType * * Description: * * Preconditions: * * Postconditions: * * Log: * Prajapati Nilesh 08 May 2008 * - Creation. */ function detectBrowserType() { //link for browser detecting http://www.javascriptkit.com/javatutors/navigator.shtml //Detecting Firefox 1.0+ if(navigator.userAgent.indexOf("Firefox")!=-1) { var versionindex=navigator.userAgent.indexOf("Firefox")+8; if (parseInt(navigator.userAgent.charAt(versionindex))>=1) { //alert("You are using Firefox 1.x or above"); return 'FX'; } } //Detect Netscape 4.7+ if (navigator.appName=="Netscape"&&parseFloat(navigator.appVersion)>=4.7) { //alert("You are using Netscape 4.7+"); return 'NS'; } //Detect IE5.5+ version=0; //navigator.userAgent.toLowerCase().indexOf("msie") if (navigator.appVersion.indexOf("MSIE")!=-1) { temp=navigator.appVersion.split("MSIE"); version=parseFloat(temp[1]); } if (version>=5.5) { //NON IE browser will return 0 //alert("You're using IE5.5+"); return 'IE'; } //Detect The Opera pitfall if(navigator.userAgent.indexOf("Opera")!=-1) { var versionindex=navigator.userAgent.indexOf("Opera")+6; if (parseInt(navigator.userAgent.charAt(versionindex))>=8) { //alert("You are using Opera 8 or 9"); return 'OP'; } } }//End of function detectBrowserType //***** AJAX CODE ************************************************************* var xmlHttp //divDebugHintObj = document.getElementById("txtHint"); appendDivVal = false; //isAllowPopup = true; function showHintAjax(str) { divDebugHintObj = document.getElementById("txtHint"); if (str.length==0) { if (divDebugHintObj && divDebugHintObj != 'undefined' && !appendDivVal) { divDebugHintObj.innerHTML = ""; } return; }//End of condition if (str.length==0) xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } /*var url="gethint.php"; url=url+"?q="+str; url=url+"&sid="+Math.random();*/ url = str; xmlHttp.onreadystatechange=stateChangedFun; xmlHttp.open("GET",url,true); //true - syncronize xmlHttp.send(null); //delete xmlHttp; }//End of function showHintAjax function stateChangedFun() { if (xmlHttp.readyState==4) { divDebugHintObj = document.getElementById("txtHint"); if (divDebugHintObj && divDebugHintObj != 'undefined') { if (appendDivVal) { divDebugHintObj.innerHTML = divDebugHintObj.innerHTML + xmlHttp.responseText; //we can return the popup demo survey url from the server side file and open popup here. //but it is good to open popup before the going to server side. //window.open(xmlHttp.responseText,'DemoGraphPopup','height=450,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes'); } else { divDebugHintObj.innerHTML = xmlHttp.responseText; } } }//End of if (xmlHttp.readyState==4) }//End of function stateChangedFun function GetXmlHttpObject() { var xmlHttp = null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }//End of function GetXmlHttpObject //******************************************************* //***** AJAX Multiple request CODE **************************** function showHintAjax_Multiple(str,reqIndex) { if (ajaxArray != 'undefined') { ajaxArray[sIndex] = GetXmlHttpObject(); if (ajaxArray[sIndex]) { /* //example for post request. //params = "addr="+serverAddress; params = str ajaxArray[sIndex].open('POST', 'stats_tracker.php', true); ajaxArray[sIndex].onreadystatechange = handleResponse; ajaxArray[sIndex].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); ajaxArray[sIndex].setRequestHeader('Content-Length', params.length); ajaxArray[sIndex].send(params);*/ url = str; ajaxArray[sIndex].onreadystatechange = handleResponse; ajaxArray[sIndex].open("GET",url,true); //true - syncronize ajaxArray[sIndex].send(null); } sIndex++; } }//End of function showHintAjax_Multiple function handleResponse() { if (ajaxArray && ajaxArray != 'undefined') { divDebugHintObj = document.getElementById("txtHint"); for (var i = 0; i < ajaxArray.length; i++) { if (ajaxArray[i] && ajaxArray[i].readyState == 4) { if (divDebugHintObj && divDebugHintObj != 'undefined') { if (appendDivVal) { divDebugHintObj.innerHTML = divDebugHintObj.innerHTML + ajaxArray[i].responseText; } else { divDebugHintObj.innerHTML = ajaxArray[i].responseText; } } ajaxArray[i] = null; } }//End of for (var i = 0; i < ajaxArray.length; i++) } }//End of function handleResponse //******************************************************************************************* //************** JS CODE FOR ajax LOADER AND PLACE PAGE IN MIDDLE OF SCREEN **************** function showIFramePanel(IFrameWidth , IFrameHeight) { divIframeTopLeft = false; //set here false because it will directly defined in css class ub create_stn_page.php file. divMasterObj = document.getElementById("divMaster"); divIframeObj = document.getElementById("divIframe"); divIframeObj.style.display='block'; divIframeObj.style.visibility='visible'; var width = screen.width / 2; var height = screen.height / 2; if (IFrameWidth && IFrameWidth != 'undefined' && IFrameHeight && IFrameHeight != 'undefined') { IFrameWidth = IFrameWidth / 2; IFrameHeight = IFrameHeight / 2; width = width - IFrameWidth; height = height + IFrameHeight; if(divIframeTopLeft) { divIframeObj.style.top="100px"; divIframeObj.style.left=width+"px"; } } else { if(divIframeTopLeft) { divIframeObj.style.top="230px"; divIframeObj.style.left="400px"; } } layerDivObj = document.getElementById("layerDiv"); layerDivObj.style.visibility='visible'; layerDivObj.style.display='block'; layerDivObj.style.height = divMasterObj.scrollHeight+ "px"; //alert(divMasterObj.scrollHeight); if (divMasterObj.scrollHeight <= 700) { layerDivObj.style.height = "700px"; } if (document.all) { //alert('document.all') layerDivObj.style.width = document.body.offsetWidth + "px"; } else if (document.layers) { //alert('document.layers'); layerDivObj.style.width = document.body.document.width + "px"; } else { //alert('else'); if (document.width < 1000) { layerDivObj.style.width = "1000px"; } else { layerDivObj.style.width = document.width + "px"; } } }//End of function showIFramePanel function isObject(a) { //return (a && typeof a == 'object') || isFunction(a); return (a && typeof a == 'object'); } // End function: isObject. function isFunction(a) { return typeof a == 'function'; } // End function: isFunction. function hideIFramePanel(allowClose,parentClose) { divIframeObj = document.getElementById("divIframe"); layerDivObj = document.getElementById("layerDiv"); // // Code for when we will press close link from the frame middle popup // if (parentClose && parentClose != 'undefined') { parentFrameObj = window.frames.parent; if (parentFrameObj && parentFrameObj != 'undefined') { mainDivObj = parentFrameObj.document.getElementById('divIframe'); mainLayerDivObj = parentFrameObj.document.getElementById('layerDiv'); divIframeObj = mainDivObj; layerDivObj = mainLayerDivObj; } }//End of condition if (parentClose && parentClose != 'undefined') iframeColl = divIframeObj.getElementsByTagName('iframe'); iFrame = false; var fileName = ''; for (x in iframeColl) { // Store the current hidden field for easy access. iFrameField = iframeColl[x]; if(isObject(iFrameField)) { if(iFrameField.tagName.toLowerCase() == 'iframe') { //temp stop this /*if (iFrameField.contentDocument) { // For NS6 IFrameDoc = iFrameField.contentDocument; } else if (iFrameField.contentWindow) { // For IE5.5 and IE6 IFrameDoc = iFrameField.contentWindow.document; } else if (iFrameField.document) { // For IE5 IFrameDoc = iFrameField.document; } fileName = DocFileNameExtract(IFrameDoc.location); iFrame = true; if (fileName == 'pleaseWaitPage.html') { iFrame = false; } break;*/ } } } if (allowClose && allowClose != 'undefined') { iFrame = false; } if (iFrame) { //if ifame than not allowed to close on setTimeOut but when we will press close button than only it will close it } else { divIframeObj.style.display='none'; divIframeObj.style.visibility='hidden'; layerDivObj.style.visibility='hidden'; layerDivObj.style.display='none'; } }//End of function hideIFramePanel var IFrameObj; // our IFrame object function callToServer(URL,IFrameWidth , IFrameHeight, closeLink) { if (IFrameWidth && IFrameWidth != 'undefined' && IFrameHeight && IFrameHeight != 'undefined') { } else { //for please wait loading page ..... if it is displaying in iframe IFrameWidth = 250; IFrameHeight = 70; } if (!document.createElement) {return true}; var IFrameDoc; divIframeObj = document.getElementById("divIframe"); divIframeObj.innerHTML = ''; if (!IFrameObj && document.createElement) { //if (document.createElement) { // create the IFrame and assign a reference to the // object to our global variable IFrameObj. // this will only happen the first time // callToServer() is called try { if (URL == 'pleaseWaitPage.html') { setTimeout("hideIFramePanel()",5000); //if it is pleaseWaitPage.html page means please wait message than again it will set 5 sec to close //it automatically } else { if (closeLink && closeLink != 'undefined') { closeButtonHTML='\
close
'; divIframeObj.innerHTML = closeButtonHTML; /*var closeLinkBtn = document.createElement('a'); closeLinkBtn.appendChild(document.createTextNode('close')); closeLinkBtn.onclick = closeBtnMainWindow; if (divIframeObj && divIframeObj != 'undefined') { divIframeObj.appendChild(closeLinkBtn); }*/ } } var tempIFrame=document.createElement('iframe'); tempIFrame.setAttribute('id','RSIFrame'); tempIFrame.setAttribute('name','RSIFrame'); tempIFrame.style.border='0px'; //tempIFrame.style.width='100px'; //tempIFrame.style.height='100px'; tempIFrame.style.width=IFrameWidth+'px'; tempIFrame.style.height=IFrameHeight+'px'; tempIFrame.frameBorder ='0px'; //for IE if (divIframeObj && divIframeObj != 'undefined') { //by nilesh IFrameObj = divIframeObj.appendChild(tempIFrame); } else { IFrameObj = document.body.appendChild(tempIFrame); } if (document.frames) { // this is for IE5 Mac, because it will only // allow access to the document object // of the IFrame if we access it through // the document.frames array IFrameObj = document.frames['RSIFrame']; } } catch(exception) { //alert("Please Check callToServer Js function ::: "+exception); // This is for IE5 PC, which does not allow dynamic creation // and manipulation of an iframe object. Instead, we'll fake // it up by creating our own objects. iframeHTML='\