// this opens the video of the day popup and at the same time changes the location in the main window

function goBack(){
  if (this.history.length > 0){
  	this.history.back()
  }
}
function Messaggio(msgStr) { //v1.2
  window.status=msgStr;
}

function jumpVod(url,storyUrl) 
{
    window.location.href=storyUrl;
	vod(url,'video', '');
}

// this will allow a popup window to be used from a pulldown navigation menu
// check interactive/2000/mondo/campdavid./include.txt for an example of how to use
// jeremy jackson

function pulldownpopup(url,name,widgets) {
    popupWin = window.open (url,name,widgets);
    popupWin.opener.top.name="opener";
    popupWin.focus();
}


// this handles the homepage picture of the day

function popNav(url,name,features) {
   if ((browser == "ns3","ns4") || (browser == "ie4")) {
   popBox = window.open(url,name,features);
   popBox.focus();
     } else {
          if (browser == "ie3") {
          popBox = window.open(url,name,features);
          }  
   }
}


// this will open a new window, submit the poll form, and send the results to the popup window
function pollSubPop (earl, name, widgets, specialsURL) {
        host = location.hostname;
        if (host.indexOf('customnews') != -1) {
                var url = 'http://customnews.cnn.com' + earl;
        } else {
                var url = earl;
        }
        popupWin = window.open(url, name, widgets);
        popupWin.opener.top.name = "opener";
        popupWin.focus();
}

// this is for opening pop-up windows
function openWindow (earl,name,widgets) {
	host = location.hostname;
	if (host.indexOf('customnews') != -1) {
		var url = 'http://customnews.cnn.com' + earl;
		} else {
			var url = earl;
			}
	popupWin = window.open (url,name,widgets);
	popupWin.opener.top.name="opener";
	popupWin.focus();
	}

// this is for opening pop-up windows
function open_window (earl,name,customfeatures) {
windowFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=215,height=250';
	host = location.hostname;
	if (host.indexOf('customnews') != -1) {
		var url = 'http://customnews.cnn.com' + earl;
		} else {
			var url = earl;
			}
	popupWin = window.open (url,name,windowFeatures);
	popupWin.opener.top.name="opener";
	popupWin.focus();
	}

// sk
// This allows you to redirect the main browser window to a new URL when launching a popup
function jumpLink( earl, name, widgets, specialsURL ) {
	host = location.hostname;
	if ( host.indexOf( 'customnews' ) != -1 ) {
		var url = 'http://customnews.cnn.com' + earl;
	} else {
		var url = earl;
	}
	popupWin = window.open( url, name, widgets );
	popupWin.opener.location = specialsURL;
	popupWin.opener.top.name = "opener";
	popupWin.focus();
}

function closeWindow () {
	parent.close ();
	}

function goTW(){
    var URL = document.pathfinder.site.options[document.pathfinder.site.selectedIndex].value;
    window.location.href = URL;
}




// tg	
function livevideo (url,streamtitle,customfeatures) {
windowFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=215,height=500';

//Browser Detection
var browser = "";
var browsername = navigator.appName;
var browserversion = parseInt(navigator.appVersion);
if (browsername == "Netscape") {
    browser = "ns" + browserversion;
} else {
    if (browsername == "Microsoft Internet Explorer") {
        if (browserversion >= 4) {
            browser = "ie" + browserversion;
        } else {
            browser = "ie3";
        }
    }
}

//if (customfeatures != '') {
//	windowFeatures = customfeatures;
//}

if (url.indexOf("real") != -1) {
	if (browser != 'ie3') {
		hasplugin = 'false';
		numPlugins = navigator.plugins.length;
		for (i = 0; i < numPlugins; i++) {
			plugin = navigator.plugins[i];
			if (plugin.name.substring(0,10)=="RealPlayer") {
				hasplugin = 'true';
			}
		}
		if (browser.substring(0,2) == 'ie') {
			hasplugin = 'true';
		}
		if (hasplugin == 'true') {
			videoWin = window.open (url , 'video', windowFeatures);
			if (streamtitle != '') {
   		 		videoWin.streamtitle=streamtitle;
   		 	}
   		 	videoWin.document.close();		
		} else {
		stream = url.charAt((url.length-6))
		location.href='/video/live/live' + stream + '.rm28.ram';
		}
	} else {
		videoWin = window.open (url , 'video', windowFeatures);
		if (document.images) {
			if (streamtitle != '') {
   				videoWin.streamtitle=streamtitle;
   			 }
   		}
   		videoWin.document.close();			
	}		
} else {
	videoWin = window.open (url , 'video', windowFeatures);
	if (document.images) {
		if (streamtitle != '') {
	    	videoWin.streamtitle=streamtitle;
	    }
	}
    videoWin.document.close();
}
}

//tg

function vod (url,streamtitle,customfeatures) {
windowFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=210,height=580';

//Browser Detection
var browser = "";
var browsername = navigator.appName;
var browserversion = parseInt(navigator.appVersion);
var browserplatform = navigator.userAgent;
if (browsername == "Netscape") {
    browser = "ns" + browserversion;
} else {
    if (browsername == "Microsoft Internet Explorer") {
        if (browserversion >= 4) {
            browser = "ie" + browserversion;
        } else {
            browser = "ie3";
        }
    }
}

if ((customfeatures) && customfeatures != '') {
	windowFeatures = customfeatures;
}


if (url.indexOf(".rm",(url.length-10)) != -1) {
	if (browser != 'ie3') {
		hasplugin = 'false';
		if ( (browserplatform.indexOf('Mac') !=-1) && ( browsername != "Netscape") )  {
			numPlugins = 0;
			for (i = 0; i < numPlugins; i++) {
				plugin = navigator.embeds[i];
				if (plugin.name.substring(0,10)=="RealPlayer") {
					hasplugin = 'true';
				}
			}
		} else {
			numPlugins = navigator.plugins.length;
			for (i = 0; i < numPlugins; i++) {
				plugin = navigator.plugins[i];
				if (plugin.name.substring(0,10)=="RealPlayer") {
					hasplugin = 'true';
				}
			}
		}
		if (browser.substring(0,2) == 'ie') {
			hasplugin = 'true';
		}
		if (hasplugin == 'true') {
			videoWin = window.open (url , 'video', windowFeatures);
			if (streamtitle != '') {
   		 		videoWin.streamtitle=streamtitle;
   		 	}
  		 	videoWin.document.close();		
		} else {
		stream = url.substring(0,(url.length-5));
		location.href=stream + '.ram';
		}
	} else {
		videoWin = window.open (url , 'video', windowFeatures);
		if (document.images) {
			if (streamtitle != '') {
   				videoWin.streamtitle=streamtitle;
   			 }
   		}
   		videoWin.document.close();			
	}		
} else {
	videoWin = window.open (url , 'video', windowFeatures);
	if (document.images) {
		if (streamtitle != '') {
	    	videoWin.streamtitle=streamtitle;
	    }
	}
    videoWin.document.close();
}
}


function med_vod(vidlocation)
{
	openWindow(vidlocation,'210x580','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=210,height=580');
}

//heres email function for CNNitalia
function italiaEmail()
{
	address=document.emailform.emailinput.value;
	location='http://www.cnnitalia.it/EMAIL/index.html?'+address;
}
 
function katScroll(ifName,divName,sspeed,baseTarget,bodyBgColor,bodyBgImage) {
	ifObj = eval('document.frames["' + ifName + '"]');
	dvObj = eval('document.all.' + divName);
	bodyAttr = '';
	if (baseTarget == null) baseTarget = '_blank';
	if (bodyBgColor != null) bodyAttr += ' bgColor=' + bodyBgColor;
	if (bodyBgImage != null) bodyAttr += ' background=' + bodyBgImage;
	ifHTML =  '<html>\n<head>\n<base target=' + baseTarget + '>\n<link rel="stylesheet" href="ultimissime.css" type="text/css">\n';
	ifHTML += '<script>var SIF_PT = 0; var SIF_TS;\nfunction ScrollIFrame(position,speed) {\n';
	ifHTML += 'window.scrollBy(0,1);position++;SIF_PT=position;\n';
	ifHTML += 'if (parseInt(document.all.scrollDiv.clientHeight/2) == position) {\n';
	ifHTML += 'window.scrollTo(0,0);position = 0;SIF_PT=position;\n}\n';
	ifHTML += 'SIF_TS = setTimeout("ScrollIFrame("+position+","+speed+")",speed);\n}\n';
	ifHTML += '</script>\n</head>\n';
	ifHTML += '<body' + bodyAttr + '>\n<div id="scrollDiv" style="position:absolute; z-index:1; width:100%;">\n' + dvObj.innerHTML + '\n</div>\n</body>\n';
	ifHTML += '<script>ScrollIFrame(0,' + sspeed + ');</script>\n</html>';
	ifWin = window.open('',ifName,'');
	ifWin.document.write(ifHTML);
	ifWin.document.close();
}

///////////////////////////


