function hideanimate()
{	
$("#allpop").fadeOut("slow");
popframe.location.href="http://www.arman-armin.com/templates/loading.php";
}

function sizes(what){
var viewportwidth,viewportheight;
if (typeof window.innerWidth != 'undefined'){
viewportwidth = window.innerWidth,
viewportheight = window.innerHeight }
else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth !=
'undefined' && document.documentElement.clientWidth != 0) {
viewportwidth = document.documentElement.clientWidth,
viewportheight = document.documentElement.clientHeight
} else {
viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
viewportheight = document.getElementsByTagName('body')[0].clientHeight	}
if(what=="w") return viewportwidth; else return viewportheight; 
}

function getScrollY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
	return scrOfY;

}

function roundmargin(){return 100;}

function pop_init(){
document.write('<div id="allpop" style="display:none;position: fixed;top:150px;left:300px;width:200;margin-right:500px;top:250;" border="0" bgcolor="#FBF9FB">');
document.write('<div id="closediv" dir="rtl"  style="cursor:move;background-image:url(images/pop/poptopbackground.gif);top:0px;left:0px;width:0px;height:24px;"><a onClick="hideanimate();" style="cursor:default"><img src="images/pop/close.png" border="0px" /></a></div><div id="popdiv" style="visibility:hidden;top:0px;left:0px;width:0px;height:0px;background-color:#fff" dir="rtl">');
document.write('<iframe frameborder="0" name="popframe" width="100%" height="100%" src="http://www.arman-armin.com/templates/loading.php" marginheight="0" border="0" frameborder="0" marginwidth="0">');
document.write('</iframe></div></div>');
}
function pop_show(address,width,height){
var a=getScrollY();
if((sizes("w")-width)/2<roundmargin()) width=sizes("w")-2*roundmargin();
if((sizes("h")-height)/2<roundmargin()) height=sizes("h")-2*roundmargin();
var leftmargin=(sizes("w")-width)/2;
var topmargin=(sizes("h")-height)/2;
popframe.location.href=address;



document.getElementById("popdiv").style.visibility="visible";
document.getElementById("popdiv").style.top=topmargin+"px";
document.getElementById("popdiv").style.left=leftmargin+"px";
document.getElementById("popdiv").style.width=width+"px";
document.getElementById("popdiv").style.height=height+"px";

document.getElementById("closediv").style.visibility="visible";
document.getElementById("closediv").style.top=(topmargin-24)+"px";
document.getElementById("closediv").style.left=leftmargin+"px";
document.getElementById("closediv").style.width=width+"px";

document.getElementById("allpop").style.top=((sizes("h")-height)/2)+"px";
document.getElementById("allpop").style.left=((sizes("w")-width)/2)+"px";


if(getScrollY()==0)
setTimeout("window.scroll(0,"+a+")",1);


}
function pop_page_resize(){
var leftmargin=(sizes("w")-document.getElementById("popdiv").offsetWidth)/2;
var topmargin=(sizes("h")-document.getElementById("popdiv").offsetHeight)/2;
document.getElementById("popdiv").style.top=topmargin+"px";
document.getElementById("popdiv").style.left=leftmargin+"px";
document.getElementById("popdiv").style.width=width+"px";
document.getElementById("popdiv").style.height=height+"px";
}

pop_init();