// JavaScript Document 

//for the goddady hosting website


function SetSiteCookie(name,value,fromurl){ //name = c_country

	document.cookie= name + "=" + value + "; path=/;";
	//alert(getCookie('c_country'));
	//alert(document.cookie);
	//if (fromurl == 0)
	//	window.location.reload(true);
	window.location.href = "/index.php";
}

function getCookie(c_name) // now is c_country
{
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=")
	  if (c_start!=-1)
		{ 
		c_start=c_start + c_name.length+1 
		c_end=document.cookie.indexOf(";",c_start)
		if (c_end==-1) c_end=document.cookie.length
		return unescape(document.cookie.substring(c_start,c_end))
		} 
	  }
	return ""
}


function createtoplogo(){
	
	var pagelogo = "CF-Top-Logo.png";
	
	if (navigator.appName == 'Microsoft Internet Explorer') /* IE 6 doesn't support PNG. if it is ie6,use *.jpg */
	{
	if (navigator.appVersion.match(/6./i)=='6.')
	pagelogo = "v3logo.jpg";
	}
	
	var strheader = "";
	strheader = strheader + "<div id=\"page\" class=\"page\"><div style=\"float:left; width:872px; text-align:left;\">";
	strheader = strheader + "<div  class=\"v3logo\"><a href=\"http://www.clickfree.com/index.php\"><img src=\"http://www.clickfree.com/images/" + pagelogo + "\" alt=\"Clickfree Automatic Backup\" border=\"0\" /></a></div> ";
	
	strheader = strheader + "</div>";
	
	document.write(strheader);
	
}
function createtopheader(){

	var pagelogo = "CF-Top-Logo.png";
	
	if (navigator.appName == 'Microsoft Internet Explorer') /* IE 6 doesn't support PNG. if it is ie6,use *.jpg */
	{
	if (navigator.appVersion.match(/6./i)=='6.')
	 pagelogo = "v3logo.jpg";
	}
	
	var strheader = "";
	strheader = strheader + "<div id=\"page\" class=\"page\"><div style=\"float:left; width:872px; text-align:left;\">";
	strheader = strheader + "<div  class=\"v3logo\"><a href=\"http://www.clickfree.com/index.php\"><img src=\"http://www.clickfree.com/images/" + pagelogo + "\" alt=\"Clickfree Automatic Backup\" border=\"0\" /></a></div> ";
	
	storelink = 'http://buy.goclickfree.com';
	
	if ( getCookie('c_country') == 'ca')
	{
	storelink = 'http://buy.clickfree.ca';
	}


//CA US and default
  HeaderLink = "<a href=\"" + storelink + "/orders.asp\" class=\"white_underline\">Order Status</a> | ";
  HeaderLink = HeaderLink + "<a href=\"" + storelink + "/myaccount.asp\" class=\"white_underline\">My Account</a> | ";
  HeaderLink = HeaderLink + "<a href=\"http://www.clickfree.com/support.php\" class=\"white_underline\">Customer Support</a> | ";
  HeaderLink = HeaderLink + "<a href=\"" + storelink + "/help.asp\" class=\"white_underline\"> Account help</a> | ";
  HeaderLink = HeaderLink + "<a href=\"" + storelink + "/shoppingcart.asp\" class=\"white_underline\">Cart</a> |";
  HeaderLink = HeaderLink + "<a href=\"/dealerstore/clickfreestore.php\" class=\"white_underline\"> Dealer Login</a> ";
  
if  (( getCookie('c_country') == 'au') || ( getCookie('c_country') == 'nz'))
{
  HeaderLink = "<a href=\"http://www.clickfree.com/support.php\" class=\"white_underline\">Customer Support</a> | ";
  HeaderLink = HeaderLink + "<a href=\"/dealerstore/clickfreestore.php\" class=\"white_underline\"> Dealer Login</a> ";
}

strheader = strheader + "<div  class=\"topNav\">";
strheader = strheader + HeaderLink;
strheader = strheader + "</div> ";


//flags

CA_img = "<img src=\"http://www.clickfree.com/images/index/Canada.gif\"  alt=\"Canada\" width=\"17\" height=\"12\" align=\"absmiddle\" style=\"border:0px solid #efefef;\"/>";
CA_Link = "<a href=\"javascript:SetSiteCookie('c_country','ca',0);\" onClick=\"pageTracker._setVar('c_country_ca');\">";

US_img = "<img src=\"http://www.clickfree.com/images/index/US.gif\" alt=\"US\" width=\"17\" height=\"12\" align=\"absmiddle\" style=\"border:0px solid #efefef;\"/>";
US_Link = "<a href=\"javascript:SetSiteCookie('c_country','us',0);\" onClick=\"pageTracker._setVar('c_country_us');\">";


UK_img = "<img src=\"http://www.clickfree.com/images/index/UK.gif\" width=\"17\" height=\"12\" align=\"absmiddle\" style=\"border:0px solid #efefef;\"  alt=\"United Kingdom\"/>";
UK_Link = "<a href=\"http://client.mcp-international.com/enfinity/Clickfree/welcome-WFS-en_GB-GBP\" target=\"_blank\">";

FR_img = "<img src=\"http://www.clickfree.com/images/index/France.gif\" width=\"17\" height=\"12\" align=\"absmiddle\" style=\"border:0px solid #efefef;\" alt=\"France\" />";
FR_Link = "<a href=\"http://client.mcp-international.com/enfinity/Clickfree/welcome-WFS-fr_FR-EUR\" target=\"_blank\" >"

IT_img = "<img src=\"http://www.clickfree.com/images/index/Italy.gif\" width=\"17\" height=\"12\"  align=\"absmiddle\" style=\"border:0px solid #efefef;\" alt=\"Italy\"/>";
IT_Link = "<a href=\"http://client.mcp-international.com/enfinity/Clickfree/welcome-WFS-nl_BE-EUR\" target=\"_blank\">";

GER_img = "<img src=\"http://www.clickfree.com/images/index/Germany.gif\" width=\"17\" height=\"12\" align=\"absmiddle\" style=\"border:0px solid #efefef;\" alt=\"Germany\"/>";
GER_Link = "<a href=\"http://client.mcp-international.com/enfinity/Clickfree/welcome-WFS-de_DE-EUR\" target=\"_blank\">";

AU_img = "<img src=\"/images/index/australia.jpg\" width=\"17\" height=\"12\" style=\"border:0px solid #efefef;\" align=\"absmiddle\" alt=\"Australia\"/>";
AU_Link = "<a href=\"http://www.clickfree.com/au/\" >";

JP_img = "<img src=\"http://www.clickfree.com/images/index/Japan.jpg\" width=\"17\" height=\"12\" align=\"absmiddle\" style=\"border:0px solid #efefef;\" alt=\"japan\"/>";
JP_Link = "<a href=\"http://www.mag-labo.jp/en/04pc/clinckfree.html\" target=\"_blank\">";

NZ_img = "<img src=\"http://www.clickfree.com/images/index/newzealand.jpg\" width=\"17\" height=\"12\" align=\"absmiddle\" style=\"border:0px solid #efefef;\" alt=\"japan\"/>";
//Flag div
strheader = strheader + "<div id='flag' style=\"float:right; width:148px; margin-top:2px; text-align:right; margin-right:0px; \">";


switch (getCookie('c_country'))
{
		case "ca":
		{
		strheader = strheader + US_Link + US_img + "</a> ";
		strheader = strheader + AU_Link + AU_img + "</a> ";
		break;
		}
		case "us":
		{
		strheader = strheader + CA_Link + CA_img + "</a> ";
		strheader = strheader + AU_Link + AU_img + "</a> ";
		break;
		
		}
		case "au":
		{
		strheader = strheader + US_Link + US_img + "</a> ";
		strheader = strheader + CA_Link + CA_img + "</a> ";
		break;
		
		}
		case "nz":
		{
		strheader = strheader + US_Link + US_img + "</a> ";
		strheader = strheader + CA_Link + CA_img + "</a> ";
		break;		
		}
		default:
		{
		strheader = strheader + CA_Link + CA_img + "</a> ";
		strheader = strheader + AU_Link + AU_img + "</a> ";
		}	
}



strheader = strheader + UK_Link + UK_img + "</a> ";
strheader = strheader + FR_Link + FR_img +"</a> ";
strheader = strheader + IT_Link + IT_img + "</a> ";
strheader = strheader + GER_Link + GER_img + "</a> ";
strheader = strheader + JP_Link + JP_img + "</a> ";

strheader = strheader + "</div>";


//for us and canada site
strheader = strheader + "<div style=\"float:right; width:300px; margin-top:3px; text-align:right; margin-right:0px; color:#fff;font-size:11px; font-weight:bold; \">";
//strheader = strheader + "You are at" ;
switch (getCookie('c_country'))
{
	case "ca":
	{
	strheader = strheader + "Clickfree Canada "
	strheader = strheader + CA_img;
	break;
	}
	case "us":
	{
	strheader = strheader + "Clickfree U.S.A ";
	strheader = strheader + US_img;
	break;
	}
	case "au":
	{
	strheader = strheader + "Clickfree Australia ";
	strheader = strheader + AU_img;
	break;
	}
	case "nz":
	{
	strheader = strheader + "Clickfree New Zealand ";
	strheader = strheader + NZ_img;
	break;
	}
	default:
	{
	strheader = strheader + "Clickfree U.S.A ";
	strheader = strheader + US_img;
	}
}


strheader = strheader + "&nbsp;&nbsp;  |&nbsp;&nbsp; Change Location </div>";

strheader = strheader + "</div>";

document.write(strheader);

}



function createtopheader_simple(){

	var pagelogo = "CF-Top-Logo.png";
	
	if (navigator.appName == 'Microsoft Internet Explorer') /* IE 6 doesn't support PNG. if it is ie6,use *.jpg */
	{
	if (navigator.appVersion.match(/6./i)=='6.')
	 pagelogo = "v3logo.jpg";
	}
	
	var strheader = "";
	strheader = strheader + "<div id=\"page\" class=\"page\"><div style=\"float:left; width:872px; text-align:left;\">";
	strheader = strheader + "<div  class=\"v3logo\"><a href=\"http://www.clickfree.com/index.php\"><img src=\"http://www.clickfree.com/images/" + pagelogo + "\" alt=\"Clickfree Automatic Backup\" border=\"0\" /></a></div> ";
	
	storelink = 'http://buy.goclickfree.com';
	
	if ( getCookie('c_country') == 'ca')
	{
	storelink = 'http://buy.clickfree.ca';
	}

strheader = strheader + "<div  class=\"topNav\">";
strheader = strheader + "<a href=\"" + storelink + "/orders.asp\" class=\"white_underline\">Order Status</a> | ";
strheader = strheader + "<a href=\"http://www.clickfree.com/support.php\" class=\"white_underline\">Customer Support</a> ";
strheader = strheader + "</div> ";


strheader = strheader + "</div>";

document.write(strheader);

}
