function createCookieValue(name,value,days) {
	document.domain = "guruenergy.com";
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
		var delDate = new Date();
		delDate.setTime(delDate.getTime()-(days*24*60*60*1000));
		var expiresD = "; expires="+delDate.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expiresD+"; path=/"+"; domain=www.guruenergy.com";
	document.cookie = name+"="+value+expires+"; path=/"+"; domain=.guruenergy.com";
}

function readCookieValueB(name) {
	document.domain = "guruenergy.com";
return parent.readCookieB(name);
}
function readCookieValue(name) {
	document.domain = "guruenergy.com";
return parent.readCookie(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);
	}
/*
	if (document.cookie.length > 0) {
		var offset = document.cookie.indexOf(nameEQ);
		if (offset != -1) {
			offset += nameEQ.length;
			var end = document.cookie.indexOf(";", offset);
// alert(end+' - '+offset);
			if (end == 1)
				end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		}
	}
	return null;
*/
}

function eraseCookieValue(name) {
	document.domain = "guruenergy.com";
	createCookieValue(name,"",-1);
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function loadSite(data) {
	document.domain = "guruenergy.com";
	// var data = document.getElementById('sitesMenu').options[selectedIndex].value;
	// alert(data);
	var info = data.split("|");
	createCookieValue('site',info[0],365);
	createCookieValue('flag',info[1],365);
	parent.location.href=info[2];
}
function showImg() {
	var flag = ''; // readCookieValue('flag');
	if (flag != null && flag != undefined && flag != "")
	document.write('<img src="/usa/images/flags_small/'+flag+'" width="27" height="31" />');
	else
	document.write('<img src="/usa/images/flags_small/usa_small.png" width="27" height="31" />');
}

var siteAct = ''; // readCookieValue('site');
// var sectAct = '';
var sectAct = sect;
if (sectAct == undefined || sectAct == null || sectAct == '') sectAct = 0;

var backg = new Array();
backg[0] = "footer_drinks.jpg";
backg[1] = "footer_about.jpg";
backg[2] = "footer_blog.jpg";
backg[3] = "footer_shop.jpg";
backg[4] = "footer_company.jpg";

var siteUrl = "/usa/";
if (siteAct == 2) siteUrl = "/canada/";
else if (siteAct == 3) siteUrl = "/quebec/";
else siteUrl = "/usa/";

document.write('<form name="form" id="form">');
document.write('  <table width="660" border="0" align="center" cellpadding="0" cellspacing="0" background="/usa/images/'+backg[sectAct]+'">');
document.write('<tr>');
document.write('<td height="35" colspan="2" valign="top" scope="col">&nbsp;</td>');
document.write('</tr>');
document.write('<tr>');
var linksFooter = '<td width="632" height="31" valign="top" scope="col"><div align="right" class="gurustyle"><a href="'+siteUrl+'company/map.php">Site Map</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="'+siteUrl+'company/privacy.php">Privacy</a> &nbsp;&nbsp;&nbsp;&nbsp;<a href="'+siteUrl+'company/terms.php">Terms of use</a>&nbsp;&nbsp;&nbsp; ';
document.write(linksFooter);
document.write('<select name="sitesMenu" class="gurustyle" id="sitesMenu" onChange="loadSite(this.options[selectedIndex].value)">');

/* USA */
document.write('                <option value="1|usa_small.png|/usa/drinks.php"');
if (siteAct == null || siteAct == undefined || siteAct == '' || siteAct == 1) document.write(' selected="selected"');
document.write('>USA</option>');

/* Canada */
document.write('                <option value="2|canada_small.png|http://www.guruenergy.ca/"');
if (siteAct == 2) document.write(' selected="selected"');
document.write('>Canada - English</option>');

/* Quebec */
document.write('                <option value="3|quebec_small.png|http://www.guruenergie.ca/"');
if (siteAct == 3) document.write(' selected="selected"');
document.write('>Canada - Fran&ccedil;ais</option>');

/* EUROPEAN UNION */
document.write('                <option value="4|eur_comunity_small.png|/usa/drinks.php"');
if (siteAct == 4) document.write(' selected="selected"');
document.write('>European Union</option>');

/* MEXICO */
document.write('                <option value="5|mexico_small.png|/usa/drinks.php"');
if (siteAct ==  5) document.write(' selected="selected"');
document.write('>Mexico</option>');

/* AUSTRALIA */
document.write('                <option value="6|australia_small.png|/usa/drinks.php"');
if (siteAct == 6) document.write(' selected="selected"');
document.write('>Australia</option>');

/* JAPAN */
document.write('                <option value="7|japan_small.png|/usa/drinks.php"');
if (siteAct ==  7) document.write(' selected="selected"');
document.write('>Japan</option>');

/* SOUTH AFRICA */
document.write('                <option value="8|south_africa_small.png|/usa/drinks.php"');
if (siteAct ==  8) document.write(' selected="selected"');
document.write('>South Africa</option>');

/* LEBANON */
document.write('                <option value="9|lebanon_small.png|/usa/drinks.php"');
if (siteAct ==  9) document.write(' selected="selected"');
document.write('>Lebanon</option>');

/* BAHAMAS */
document.write('                <option value="10|bahamas_small.png|/usa/drinks.php"');
if (siteAct == 10) document.write(' selected="selected"');
document.write('>Bahamas</option>');

/* ISRAEL */
document.write('                <option value="11|israel_small.png|/usa/drinks.php"');
if (siteAct ==  11) document.write(' selected="selected"');
document.write('>Israel</option>');

/* U.A.E */
document.write('                <option value="12|aue_small.png|/usa/drinks.php"');
if (siteAct ==  12) document.write(' selected="selected"');
document.write('>U.A.E</option>');

/* INDONESIA */
document.write('                <option value="13|indonesia_small.png|/usa/drinks.php"');
if (siteAct ==  13) document.write(' selected="selected"');
document.write('>Indonesia</option>');

/* TUNESIA */
document.write('                <option value="14|tunesia_small.png|/usa/drinks.php"');
if (siteAct ==  14) document.write(' selected="selected"');
document.write('>Tunesia</option>');


/* MALAYSIA */
document.write('                <option value="15|malaysia_small.png|/usa/drinks.php"');
if (siteAct ==  15) document.write(' selected="selected"');
document.write('>Malaysia</option>');

/* INTERNATIONAL */
document.write('                <option value="16|international_small.png|/usa/drinks.php"');
if (siteAct ==  16) document.write(' selected="selected"');
document.write('>International</option>');

document.write('              </select>');
/* document.write(' '+siteAct+' == '+readCookieValueB('flag')+readCookieValue('site')+' [] '+ document.cookie.length+' || '+navigator.cookieEnabled); */
/* document.write(sect+' oo '); */
document.write('</div></td>');
document.write('<td valign="top" scope="col"><span class="gurustyle"><script>showImg();</script></span></td>');
document.write('</tr>');
document.write('  </table>');
document.write('</form>');

/*
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
var pageTracker = _gat._getTracker("UA-4959355-1");
pageTracker._initData();
pageTracker._trackPageview();
*/

