
function GetCookie (name) 
{  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return "";
}

function getCookieVal(offset) 
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}


function RemoveCookie (name) 
{ 
	if (GetCookie(name) != "") 
	{
		document.cookie = name +  "="  + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
 	}
}





function logFox(lbl,screenname) {
    
     cfwb_log('', '', lbl, '', '', screenname, '', '');
   }


function openWindow(fileName)
{
	//alert("filename is "+fileName);
	
	//var fileName = "";
	var w = 680;
	var h = 520;
	
	/*
	if (section == "policy")
	{
		fileName = "http://dev4.cokemusic.com/home/privacypolicy.html";
		w = 570;
		h = 520;
	}	
	else
	{
		fileName = "http://dev2.cariocas.cokemusic.com/cdc/rules.jsp";
		w = 680;
		h = 520;
	}
	*/
	if (fileName.indexOf("policy")!=-1)
	{
		w = 570;
		h = 520;
	
	}
	
	//var winl = (screen.width - w) / 2;
	//var wint = (screen.height - h) / 2;
	var winl = 0;
	var wint = 0;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable=0,menubar=0' ;
	title = 'CokeMusic' ;
	win = window.open(fileName, title, winprops);
	if(win) {
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	}
}


var wtl_loc = document.URL.indexOf('https:')==0?'https://a248.e.akamai.net/v/248/2120/1d/download.akamai.com/crs/lgsitewise.js':'http://crs.akamai.com/crs/lgsitewise.js';
document.write("<SCR" + "IPT Language = 'JavaScript' SRC = '" + wtl_loc + "'></SCR" + "IPT>");


function tracking(logfoxtitle,wtl_title,CONTENTGROUP,wtl_url){
logFox(logfoxtitle);
var wtl_TagID = 133378;
var wtl_SID = "133378";
var wtl_Offset = "-500";
WTL_TAG = new Image;
WTL_TAG.ID = "WTL_TAG";

wtl_Tag6(wtl_TagID,wtl_SID,wtl_url,wtl_title,CONTENTGROUP);
}


/* Function doCMTracking
*  Params: (* Obligatory)
*	 - * contentGroup: String CONTENTGROUP,SUBCONTENTGROUP; example: "Games,Sumo"
*	 - documentURL: String Current URL to be tracked; example: "http://www.cokemusic.com/cstudios/cslanding1.jsp"
*	 - redirectURL: String Redirec to this URL after tracking; example: "http://www.cokemusic.com/games/coaster.swf"
*	 - documentTitle: String Page Title; example: "CokeMusic - Registration"
*    - * newWindow: [0,1] The redirect window opens in a new window.
*/
function doCMTracking (contentGroup, documentURL, redirectURL, documentTitle, newWindow) {

	if (documentURL == "")
		var wtl_url = document.URL;
	else
		var wtl_url = documentURL;
	if (documentTitle == "")
		var wtl_title = document.title;
	else
		var wtl_title = documentTitle;
	WTL_TAG = new Image;
	WTL_TAG.ID = "WTL_TAG";

	var ORDER= "";
	var SERVER= "";
	var INVOICE= "";
	var CARTVIEW= "";
	var CARTADD= "";
	var CARTREMOVE= "";
	var CHECKOUT= "";
	var CARTBUY= "";
	var ADCAMPAIGN= "";

	//wtl_Tag6(TAG,SID,wtl_url,wtl_title,"MainContentGroup,SubContentGroup");
	wtl_Tag6(wtl_TagID,wtl_SID,wtl_url,wtl_title,contentGroup);

	if (redirectURL != "")
	{
		if(newWindow == 1)
			window.open(redirectURL, 'fileWindow', 'scrollbars=yes,resizable=yes,menubar=yes');
		else if ( newWindow == 0 )
			window.location = redirectURL;
		else {
			var instructions = redirectURL.substr(11);
			eval(instructions);
		}
	}
}

//--Funcion de reconocimiento de Navegador by Jairo pinzon

function detectBrowser(){
	//----
	var validB = Boolean;
	//----
	var browser=navigator.appName
	if (navigator.appName.toLowerCase().indexOf("microsoft") || navigator.appName.toLowerCase().indexOf("windows"))  {
			validB = true;
			//alert("Su browser es internet explorer y esta bien")
		}else{
			validB = false
			//alert("Paila este browser no funca")
		}
	return validB;
}

//FLASH CALLBACK
var tryCallParentFunction = 500;
function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
}
function callParentFunction(id, fnc, param)
{
	callParentFunction_tunnel(id, fnc, param);
}
function callParentFunction_tunnel(id, fnc, param)
{
	try
	{
		var objMovie = thisMovie(id);
		if(objMovie != null)
		{
			if(objMovie[fnc] != null && objMovie[fnc](param) == "success") return;
		}
	}
	catch(ev)
	{
	}
	
	setTimeout(function() { callParentFunction(id, fnc, param); }, tryCallParentFunction);
}