//
// global.js
//
// General JavaScript functions for the Kodak Gallery
//



//	
// track_frame()
//
// Used for HitBox Tracking
// 
function track_frame(url){
	if(parent.frames["tracking"])
		parent.frames["tracking"].location = "tracking/" + url + ".html";
}



//	
// goLink()
//
// Switch statement to determind link
// input - link number from external source (Flash)
// 

function goLink(linkNum)
	{
		switch (linkNum)
			{
				case 1://Digital Camera -- demo
					window.open("http://www.kodak.com/eknec/PageQuerier.jhtml?pq-path=6628","_new",'width=580,height=415,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No,left=' + ((screen.width/2)-290) + ',top=' + ((screen.height/2)-208));
					break;
				case 2://Printer Dock
					window.open("http://www.kodak.com/eknec/PageQuerier.jhtml?pq-path=6587&pq-locale=en_US","_new");
					break;
				case 3://Mobile 
					window.open("http://www.kodakmobile.com/PSWelcome.jsp?sourceid=898816534203","_new");
					break;
				case 4://Kiosk
					window.open("http://www.kodak.com/eknec/PageQuerier.jhtml?pq-path=502&pq-locale=en_US","_new");
					break;
				case 8://Privacy
					window.open("http://www.kodak.com/US/en/corp/privacy/index.shtml","_new");
					break;
				case 9://Website Terms of Use
					window.open("http://www.kodak.com/eknec/PageQuerier.jhtml?pq-path=5327&pq-locale=en_US","_new");
					break;
				case 10://Kodak.com
					window.open("http://www.kodak.com","_new");
					break;
				case 11://KESG 			
					window.open("http://www.kodakgallery.com/Register.jsp?cm_ven=ptnr_kcom&cm_cat=microsite&cm_pla=wing&cm_ite=null&sourceid=394486817203","_new");
					break;
				case 12://Printer Dock Camera			
					window.open("http://www.kodak.com/eknec/PageQuerier.jhtml?pq-path=7103&pq-locale=en_US","_new");
					break;	
				case 13://Email Updates			
					window.open("http://www.kodak.com/global/mul/digital/wrt/campaigns/AC00002/entry.jhtml","_new");
					break;	
			}
	}
			
			
// GUYS FUNCTIONS
function getCookie(name){
	var pos = document.cookie.indexOf(name);
	if(pos == -1){return false;}
	var start = pos + name.length + 1;
	var end = document.cookie.indexOf(';',start);
	if(end == -1){
		end = document.cookie.length;
	}
	var value = document.cookie.substring(start, end);
	return unescape(value);
}


function setCookie(name, value, expires, domain, path){
	var theCookie = name+"=" + value + "; ";
	if(expires != true){
		var nextYear = new Date(); nextYear.setFullYear(nextYear.getFullYear() + 1);
		var expires = nextYear.toGMTString();
		theCookie += "expires=" + nextYear.toGMTString() + "; ";
	}
	if(domain){
		theCookie += "domain=" + domain + "; ";
	}
	if(path){
		theCookie +="path=" + path + "; ";
	}
	document.cookie = theCookie;
}


var value_KCID = "";
function Landing_Page_Execute(){
	var qs = location.search.substr(location.search.indexOf("?")+1);
	qs = qs.split("&");
	for (var i=0; i<qs.length; i++){
		val = qs[i].split("=");
		if(val[0] == "CMP"){
			value_KCID = val[1];
			setCookie("EKCAMPAIGNID", value_KCID);
		}

	}
}

function getCampaingID(){
	var aCampaignID = (getCookie("EKCAMPAIGNID") != "") ? getCookie("EKCAMPAIGNID") : "none";
	return aCampaignID;
}
function launchDemo(){
	window.open("demo_frame.html","kodak",'width=521,height=356,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No,left=' + ((screen.width/2)-260) + ',top=' + ((screen.height/2)-178));  
	NewWindow.focus();
	void(0);
}

