function printpage(num,proptype) {
	window.open("/printable.php?proptype="+proptype+"&op=yes&mid="+num,'','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=600,left = 100,top = 100');

}

function gocontact(num,type,proptype){
	window.open("/inquire.php?proptype="+proptype+"&type="+type+"&pop=yes&mid="+num,'','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=425,left = 100,top = 100');


}
function gofavorite(num){
	window.open("/save_favorite.php?pop=yes&mid="+num,'','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=425,left = 100,top = 100');


}

function gomap(num,proptype){
	window.open("/map.php?proptype="+proptype+"&pop=yes&mid="+num,'','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=425,left = 100,top = 100');

}
function gocalc(num,price){
	window.open("/calc.php?price="+price+"&pop=yes&mid="+num,'','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=425,left = 100,top = 100');

}

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 null
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function register(mlsnum,type){

	var numberofviews = getCookie('numviews');
	
	if (numberofviews == '' || numberofviews == null){
		setCookie('numviews',1,30);
	}else{
		numberofviews = parseInt(numberofviews) + 1;
		setCookie('numviews',numberofviews ,30);
	}
	
	if (numberofviews > 2){
		var cookie = getCookie('registered');
		if (cookie == '' || cookie == null){
		document.location="/register.php?mid="+mlsnum+"&proptype="+type+"";
		}else{
		document.location="/"+type+"-"+mlsnum+".php";
		}
	}else{
		document.location="/"+type+"-"+mlsnum+".php";
	}

}
