
var f_Path = "";
//var defaultLandingPage = "/index.html";
var defaultLandingPage = "/global/";

if (window.location.host.indexOf("iomega.com") == -1
    || window.location.hostname == "search.iomega.com" 
    || window.location.hostname == "datarecovery.iomega.com" 
    || window.location.hostname == "legacynt.iomega.com" 
    || window.location.hostname == "forums.iomega.com" 
    || window.location.host.indexOf("-net.iomega.com") != -1) {
  f_Path = window.location.protocol + "//www.iomega.com";
}

function FixCookieDate (date) { 
   var base = new Date(0); 
   var skew = base.getTime(); // dawn of (Unix) time - should be 0 
   if (skew > 0)   // Except on the Mac - ahead of its time 
      date.setTime (date.getTime() - skew); 
} 

function getCookieVal (offset) { 
   var endstr = document.cookie.indexOf (";", offset); 
   if (endstr == -1) 
      endstr = document.cookie.length; 
   return unescape(document.cookie.substring(offset, endstr)); 
} 

function getCookie(c_name)
{
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 SetCookie (name, value,expires,path,domain,secure) { 
  var argv = SetCookie.arguments; 
   var argc = SetCookie.arguments.length;
	 exDate = new Date;
	 if (expires == null) expires = exDate.setMonth( exDate.getMonth() + 6 );
   //var expires = (argc > 2) ? argv[2] : null; 
   var path = (argc > 3) ? argv[3] : null; 
   var domain = (argc > 4) ? argv[4] : null; 
   var secure = (argc > 5) ? argv[5] : false; 
   if (expires!=null) FixCookieDate(expires); 
   
   document.cookie = name + "=" + value + //escape (value) + 
      ((expires == null) ? "" : ("; expires=" + exDate.toGMTString())) + 
      ((path == null) ? "" : ("; path=" + path)) + 
      ((domain == null) ? "; domain=iomega.com" : ("; domain=" + domain)) + //Added iomega.com 26Jun08.  Was empty
      ((secure == true) ? "; secure" : "");
}

function checkCookie(name) {
	var LA = GetCookie(name);
	if ((LA == "")||(LA == null)) {
		window.location = f_Path+defaultLandingPage; 
	}
	else {	window.location = LA +""; }
}

function DeleteCookie(name) {
 
	if (getCookie(name) != null) {
	    document.cookie = name + "="+f_Path+defaultLandingPage+"; domain=iomega.com; expires=Thu, 01-Jan-70 00:00:01 GMT;";
	}
    window.location = f_Path+defaultLandingPage;

}

function GoNa(text) {
		SetCookie ('url',text,null,'/');
		window.location =  text;
}

function Go(text) {
  if (!document.theForm || document.theForm.defaultL.checked) {
		SetCookie ('url',text,null,'/');
		window.location =  text;
	}
	else { window.location =  text;	}
}