function popupgetPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	popupscroll();
}

function popupcsrollposition() {
	  return document.body.scrollTop;
	}

function popupscroll(){
	document.getElementById('start_popupdiv').style.top = popupcsrollposition() + 100;
}

function setpopupCookie(){
	var exdays = 1;
	var exdate=new Date();
	exdate.setDate(exdate.getDate() + 1);
	var c_value="1" + ((exdays===null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie="popup=1";
}

function getpopupCookie(){
	var i,x,y,ARRcookies=document.cookie.split(";");
	for (i=0;i<ARRcookies.length;i++){
  		x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  		y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  		x=x.replace(/^\s+|\s+$/g,"");
  		if (x=="popup"){
    		return unescape(y);
    	}
  	}
}

function checkpopupCookie(){
	var popup=getpopupCookie();
  	if (popup!=null && popup!=""){
  		return true;
  	}
	else{
  		return false
  	}
}

function closepopup(){
	setpopupCookie();
	//showform('','','clear.php?', 'start_div');
	document.getElementById('test_table').style.visibility = 'hidden';
	document.getElementById('start_popupdiv').style.visibility = 'hidden';
}

function clickpopup(){
	closepopup();
	window.location = "http://www.facebook.com/pages/%E1%83%93%E1%83%98%E1%83%9B%E1%83%98%E1%83%A2%E1%83%A0%E1%83%98-%E1%83%A8%E1%83%90%E1%83%A8%E1%83%99%E1%83%98%E1%83%9C%E1%83%98Dimitri-Shashkini/209313762439086";
}

function showpopup(){
	if(checkpopupCookie() == false){
		document.write('<center>');
		document.write('<div style="width: 320px">');
		document.write('<div style="float: right; width: 50px; margin-right: 15px; cursor: pointer; background: #FFF" onclick="closepopup()">close X</div>');
		document.write('<img style="cursor: pointer" src="images/facebok_minister.png" onclick="clickpopup()">');
		document.write('</div>');
		document.write('</center>');
	}
}

//window.onscroll = popupgetPageSizeWithScroll;
//window.onload = popupgetPageSizeWithScroll;
