// JavaScript Document
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(c_name,value,expiredays,path,domain)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString()) +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "");
}

function checkCookie()
{
var params=ParseParams();
var CLICK=params['CLICK'];
   if(CLICK.indexOf('http://')!=0) 
  { 
  userid=CLICK;
} 
username=getCookie('username');
username=ParseParams().username=userid;              //username=prompt('Please enter your name:',"");
  if (username!=null && username!="")
    {
    setCookie('username',username,365);
    }
}

function ParseParams() 
{ 
		  var res=new Array();
	      var href=new String(window.location.href);
	      var qi=href.indexOf('?');
	      if(qi!=-1) {
			
		  var tail=new String(href.substr(qi+1));
		  var params=tail.split('&');
		  for(var i=0;i<params.length;i++) {
					
			if(params[i].indexOf('=')!=-1) {
				var split=params[i].split('=');
				res[split[0].toUpperCase()]=split[1];
				} else {
					res[params[i].toUpperCase()]='';
			  }
		    }
	      }
	     return res;		
}
  
function showdemo()
{
  url="http://www.ivotechnology.com/preview/pro.php?ivey&url=" + document.demo.url.value;
  parent.location.href = url;
}


function userNav() 
{
username=getCookie('username');
   if (username!=null && username!="")
    {
	window.location.href = "http://www.ivotechnology.com/?Click="+username;
    }
	else { 
	    window.location.href = "http://www.ivotechnology.com/?Click=1"; 
	}
  
}

function enrollNav() 
{
username=getCookie('username');
   if (username!=null && username!="")
    {
    window.location.href = "http://shop.ivotechnology.com/?Click="+username;
	//window.location.href = "https://shop.ivotechnology.com/login.asp?Click="+username;
    }
	else { 
	    window.location.href = "http://shop.ivotechnology.com/?Click=1";
	    //window.location.href = "https://shop.ivotechnology.com/login.asp?Click=1"; 
	}
  
}

function homeNav() 
{
username=getCookie('username');
   if (username!=null && username!="")
    {
	window.location.href = "http://www.thevirtualnetworker.com/?Click="+username;
    }
	else { 
		window.location.href = "http://www.thevirtualnetworker.com/?Click=1";
	}
  
}

//iVo Pro Models Links to Volusion Categories


function tvnClassic() 
{username=getCookie('username');
   if (username!=null && username!="")
   { 
   window.location.href = "http://shop.ivotechnology.com/ProductDetails.asp?ProductCode=tvn-classic&Click="+username;
   } 
   else { 
        window.location.href = "http://shop.ivotechnology.com/ProductDetails.asp?ProductCode=tvn-classic&Click=1";
   }
}

function tvnPro() 
{username=getCookie('username');
   if (username!=null && username!="")
   { 
   window.location.href = "http://shop.ivotechnology.com/ProductDetails.asp?ProductCode=tvn-pro&Click="+username;
   } 
   else { 
        window.location.href = "http://shop.ivotechnology.com/ProductDetails.asp?ProductCode=tvn-pro&Click=1";
   }
}

function tvnElite() 
{username=getCookie('username');
   if (username!=null && username!="")
   { 
   window.location.href = "http://shop.ivotechnology.com/ProductDetails.asp?ProductCode=tvn-elite&Click="+username;
   } 
   else { 
        window.location.href = "http://shop.ivotechnology.com/ProductDetails.asp?ProductCode=tvn-elite&Click=1";
   }
}



			
