var VAR_Id_modAdver, VAR_OrginalW_modAdver, VAR_OrginalH_modAdver, VAR_Opacity_modAdver, VAR_ScreenX_modAdver, VAR_ScreenY_modAdver, VAR_Left_modAdver, VAR_Top_modAdver;
function modAdver(Id){
	if (Id!='[object]')
		Id = document.getElementById(Id);
	if (Id!='[object]')
		return false;
	VAR_Id_modAdver = Id;
	VAR_Opacity_modAdver = 0;
	Id.style.position = 'absolute';
	Id.style.display = 'block';
	VAR_OrginalW_modAdver = Id.clientWidth;
	VAR_OrginalH_modAdver = Id.clientHeight;
	Id.style.width = 1;
	Id.style.height = 1;
	Id.innerHTML = "<div class='modAdver_closebar'><img onclick='modAdverClose();' src='images/close.gif'/></div>" + Id.innerHTML;
	modAdverResize();
	window.attachEvent("onscroll",modAdverScrollLock);
	window.attachEvent("onresize",modAdverResize);
}
function modAdverScrollLock(){
	window.scroll(0,0);
}

function modAdver_getScrollXY(mSelect) {
	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;
	}
	if (mSelect=='x' || mSelect==0)
		return scrOfX;
	return scrOfY;
}


function modAdverScroll(){
	move(10, 10, VAR_OrginalW_modAdver, VAR_OrginalH_modAdver);
	return 0;
	VAR_ScreenX_modAdver = document.body.clientWidth;
	VAR_ScreenY_modAdver = document.body.clientHeight;
	VAR_Id_modAdver.style.top = (modAdver_getScrollXY(1)+ (VAR_ScreenY_modAdver/2)) - (VAR_Id_modAdver.clientHeight/2);
	VAR_Id_modAdver.style.left = (modAdver_getScrollXY(0)+ (VAR_ScreenX_modAdver/2)) - (VAR_Id_modAdver.clientWidth/2);
}

function move(w,h, Mw, Mh){
	if(w<Mw)w+=w/2;
	if(h<Mh)h+=h/2;
	VAR_Id_modAdver.style.width = w ;
	VAR_Id_modAdver.style.height = h ;
	VAR_Id_modAdver.style.filter = 'alpha(opacity='+ VAR_Opacity_modAdver +')';
	VAR_Opacity_modAdver+=10;
	VAR_Left_modAdver = (modAdver_getScrollXY(0)+ (VAR_ScreenX_modAdver/2)) - (VAR_Id_modAdver.clientWidth/2);
	VAR_Top_modAdver = (modAdver_getScrollXY(1)+ (VAR_ScreenY_modAdver/2)) - (VAR_Id_modAdver.clientHeight/2);
	VAR_Id_modAdver.style.top = (modAdver_getScrollXY(1)+ (VAR_ScreenY_modAdver/2)) - (VAR_Id_modAdver.clientHeight/2);
	VAR_Id_modAdver.style.left = (modAdver_getScrollXY(0)+ (VAR_ScreenX_modAdver/2)) - (VAR_Id_modAdver.clientWidth/2);
	if (w<Mw || h<Mh){
		setTimeout("move("+ w +","+ h +","+ Mw +","+ Mh +")", 30);
	}else{
		VAR_Id_modAdver.style.filter = 'alpha(opacity=100)';
	}
}

function modAdverResize(){
	VAR_ScreenX_modAdver = document.body.clientWidth;
	VAR_ScreenY_modAdver = document.body.clientHeight;
	modAdverScroll();
}

function modAdverClose(){
	var Id = document.getElementById("mypopf");
	VAR_Opacity_modAdver = 100;
	if (Id){
		moving(VAR_Left_modAdver,VAR_Top_modAdver);
	}else{
		window.detachEvent("onscroll",modAdverScrollLock);
	}
}

function moving(x,y){
	var xF=modAdverGetLeft("mypopf")-100, yF=modAdverGetTop("mypopf");
	if(yF-VAR_Top_modAdver>0 && y<yF){
		y+=40;
	}else if(yF-VAR_Top_modAdver>0 && y>yF){
		y=yF;
	}else if(y>xF){
		y-=40;
	}else{
		y=yF;
	}
	if(xF-VAR_Left_modAdver<0 && x<xF){
		x+=3;
	}else if(xF-VAR_Left_modAdver<0 && x>xF){
		x=xF;
	}else if(x>xF){
		x-=3;
	}else{
		x=xF;
	}
	VAR_Opacity_modAdver-=3;

	VAR_Id_modAdver.style.left = x;
	VAR_Id_modAdver.style.top = y;
	VAR_Id_modAdver.style.width = parseInt(VAR_Id_modAdver.style.width) - (parseInt(VAR_Id_modAdver.style.width)*5/100);
	VAR_Id_modAdver.style.height = parseInt(VAR_Id_modAdver.style.height) - (parseInt(VAR_Id_modAdver.style.height)*10/100);
	VAR_Id_modAdver.style.filter = 'alpha(opacity='+ VAR_Opacity_modAdver +')';
	//VAR_Id_modAdver.moveTo(x,y);
	if ((x>xF || y<yF)){
		setTimeout("moving("+ x +","+ y +");",1);
	}else{
		VAR_Id_modAdver.style.filter = 'alpha(opacity=0)';
		VAR_Id_modAdver.style.display = "none";
		window.detachEvent("onscroll",modAdverScrollLock);
	}
}

function modAdverGetLeft(Id){
	var iReturnValue = 0;
	if(Id!='[object]')
		Id = document.getElementById(Id);
	if (Id!='[object]')
		return 0;
	elementid=Id;
	while( elementid != null ){
	iReturnValue += elementid.offsetLeft;
	elementid = elementid.offsetParent;
	}
	return iReturnValue;
}

function modAdverGetTop(Id){
	var iReturnValue = 0;
	if(Id!='[object]')
		Id = document.getElementById(Id);
	if (Id!='[object]')
		return 0;
	elementid=Id;
	while( elementid != null ){
	iReturnValue += elementid.offsetTop;
	elementid = elementid.offsetParent;
	}
	return iReturnValue;
}