/*Detect the current page name */
function chkpage(){

var parts = location.href.split('/'); 
var str = parts[parts.length-1].split('.')[0]; 
	
	if (str.match("2008home") == "2008home") 
		{ 
			showimage(); 
		}
	else if (str.match("default") == "default")
		{ 
			showimage(); 
		}
	else if (location.href == "http://www.imc-miracles.com/") 
		{
			showimage();
		}
	else if (location.href == "http://imc-miracles.com/") 
		{
			showimage();
		}
	else if ( str.match("Info_can") == "Info_can")
		{
		}
	else if ( str.match("fspintro_can") == "fspintro_can")
		{
		}
	else if ( str.match("fspintro") == "fspintro")
		{
		}
		else if ( str.match("info") == "info")
		{
		}
	else if ( str.match("fspintro") == "fspintro")
		{
			showimage();
		
		}
	else if (str.match("Info") == "Info" && getCookie().length == 0) 
		{	
			showimage(); 
		}
	else if (str.match("Detsearch") == "Detsearch" && getCookie().length == 0) 
		{
			showimage(); 
		}

	/*Identify what country selected and change info link href if canadian*/
	if(getCookie()=='1') 
	{ 
		document.getElementById("FSPInfo").href = "fspintro_can.asp";		
	}
}

/*show the flag images function*/
function showimage(){

	var s = document.getElementById("flags"); 
	s.style.visibility = "visible";

	if(getCookie()=='0') 
	{ 
		document.getElementById("ca").src = 'images/_header/CA_pricing_off.gif';
	}
	else if(getCookie()=='1') 
	{
		document.getElementById("us").src = 'images/_header/US_pricing_off.gif';
	}
}
	
/*cookie handler group*/

function setCookie(value)
{
var exdate=new Date();
var expiredays = 1;
exdate.setDate(exdate.getDate()+expiredays);
document.cookie="origin"+ "=" +escape(value)+ ((expiredays==null) ? "" : "; expires="+exdate.toGMTString()) + ',path=/;domain=imc-miracles.com';

refresh()
}

function getCookie()
{
var c_name = "origin";
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 refresh()
{
	var sURL = unescape(window.location);
    window.location.href = sURL;
}

function deleteCookie()
{
    //alert(document.cookie);
    var d = new Date();
    document.cookie = "origin=1;expires=" + d.toGMTString() + ',path=/;domain=imc-miracles.com' + ";" + ";";
    //alert(document.cookie);
}

function pointer(id)
{
document.getElementById(id).style.cursor = 'pointer';
document.getElementById(id).src = 'images/_header/' + id +'_pricing_hover.gif';
}

function pointerout(id)
{
if(getCookie()=='0') 
	{ 
		document.getElementById("ca").src = 'images/_header/CA_pricing_off.gif';
	}
else if(getCookie()=='1') 
	{
		document.getElementById("us").src = 'images/_header/US_pricing_off.gif';
	}
else 
	{
		document.getElementById(id).src = 'images/_header/' + id +'_pricing.gif';
	}
}
