var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var bouncelimit=32 //(must be divisible by 8)
var direction = "up"
var bHasMember = False

function initbox(){
	if (!dom&&!ie&&!ns4)
	return
	crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
	scroll_top=(ie)? document.body.scrollTop : window.pageYOffset
	crossobj.top = scroll_top - 250
	crossobj.visibility=(dom||ie)? "visible" : "show"
	dropstart = setInterval("dropin()", 50)
}

function dropin(){
	scroll_top=(ie)? document.body.scrollTop : window.pageYOffset
	if (parseInt(crossobj.top)<100+scroll_top)
	crossobj.top = parseInt(crossobj.top) + 40
	else{
	clearInterval (dropstart)
	bouncestart = setInterval("bouncein()", 50)
	}
}

function bouncein(){
	crossobj.top = parseInt(crossobj.top) - bouncelimit
	if (bouncelimit<0)
	bouncelimit+=8
	bouncelimit = bouncelimit * -1
	if (bouncelimit==0){
	clearInterval (bouncestart)
	}
}
function dismissbox(){
	if (window.bouncestart) clearInterval(bouncestart)
	crossobj.visibility = "hidden"
}
	
function cookiecheck(){
	var currentvalue
	var uservalue =5;
	var popoverdelay = 18000;
	
	var memName;
	var memID;
	
	//:[ Check Popover cookie to see if we drop it on the user
	if(getcookie('popover') > 0)
	{
		currentvalue = getcookie('popover');
		if(currentvalue == (uservalue+1))
		{
		}
		else
		{
			currentvalue = parseInt(currentvalue) + 1;
			setcookie('popover', currentvalue ,364);
			setTimeout('initbox()', popoverdelay);
		}
	}
	else
	{
		setcookie('popover',2,364); 
		setTimeout('initbox()', popoverdelay);
	}
	//:[ Check Member cookie (was it loaded last time on this page?)
	if(getcookie('memName') > ""){
		memName = getcookie('memName');
		memID = getcookie('memID');
		bHasMember = True;
	}
	else
	{
		bHasMember = False;
	}		
}	
//window.onload=initbox

function getexpirydate( nodays){
	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}
function getcookie(cookiename) {
	 var cookiestring=""+document.cookie;
	 var index1=cookiestring.indexOf(cookiename);
	 if (index1==-1 || cookiename=="") return ""; 
	 var index2=cookiestring.indexOf(';',index1);
	 if (index2==-1) index2=cookiestring.length; 
	 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}
function setcookie(name,value,duration){
	cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration);
	document.cookie=cookiestring;
	//document.write("Saved");
	if(!getcookie(name)){
	return false;
	}
	else{
	return true;
	}
}
function date1(){
	now = new Date();
	then = new Date(" Jan 01 1970 00:00:00");
	seconds=now-then/1000;
	month=1+now.getMonth();
	day=now.getDate();
	year=now.getFullYear();
	document.write( day+"-"+month+"-"+year+"");
}
function checkout(){
		if(getcookie('buy')=="yes")
		{
			return true;
		}
		else
		{
			window.location.href = "default.htm";
			openIT('mc.htm',410,410,null,null,'mywinname01');
		}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
function init() {
	for (var i=1;i<4;i++) {
		var x = Cookies['ppkcookie' + i];
		if (x) alert('Cookie ppkcookie' + i + '\nthat you set on a previous visit, is still active.\nIts value is ' + x);
	}
}
