function MM_checkPlugin(plgIn, theURL, altURL, autoGo)
{ //v4.0
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}

function Fanclar(objValue)
{
	document.form.styleBody.value=objValue;
	document.form.submit();
}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}


function setCookie(name, value, expires, path, domain, secure)
{
	var myDate=new Date()
	myDate.setFullYear(2010,0,14)
	expires = myDate;
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function deleteCookie(name, path, domain)
{
    if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

function SetCookie2(cookieName,cookieValue,nDays)
{
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}

function openWindow(sPage, sName, iWidth, iHeight)
{
	window.open(sPage,sName,'width='+iWidth+',height='+iHeight+'');
}

function openNewWindow(URLtoOpen, windowName, windowFeatures) {
        newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}

function openVirtualWorldGen(country)
{
	var brand = 'KO-CEA';
	var ucdid = '39';
	var title = 'Virtual_World_CocaCola';
	var cokebrand = '';

	switch(country)
	{
		case 'cr':
			ucdid = '39';
			cokebrand = 'Costa Rica Brand';
			break;
		case 'co':
			ucdid = '40';
			cokebrand = 'colombia_brand';
			break;
		case 'do':
			ucdid = '41';
			cokebrand = 'Dominican Republic Brand';
			break;
		case 'ec':
			ucdid = '42';
			cokebrand = 'Ecuador Brand';
			break;
		case 'sv':
			ucdid = '43';
			cokebrand = 'El Salvador Brand';
			break;
		case 'gt':
			ucdid = '44';
			cokebrand = 'Guatemala Brand';
			break;
		case 'hn':
			ucdid = '45';
			cokebrand = 'Honduras Brand';
			break;
		case 'ni':
			ucdid = '46';
			cokebrand = 'Nicaragua Brand';
			break;
		case 'pa':
			ucdid = '47';
			cokebrand = 'Panama Brand';
			break;
		case 've':
			brand = 'KO-VE';
			ucdid = '48';
			cokebrand = 'Venezuela Brand';
			break;
		case 'tt':
			brand = 'KO-CRB';
			ucdid = '38';
			cokebrand = 'Caribbean_Brand';
			break;
	}
	dcsMultiTrack('WT.ti','VirtualWorld','DCS.dcsuri','/virtualworld.asp','WT.sp', cokebrand);

	//var sURL = 'http://coca-cola.interalia.net/vworld/?brand='+brand+'&ucdid='+ucdid;
	var sURL = 'http://vw2.ko.interalia.net/index.alia?brand='+brand+'&ucdid='+ucdid;
	var sWindowParam = 'scrollbars=no,width=1020‚height=700‚outerHeight=750‚outerWidth=1020'

	var win = window.open(sURL,title,sWindowParam);

	if(win==null || typeof(win) == 'undefined')
		alert('Blocked Pop-up, please enable and try again');

 }
