
//siryo-------------------------------------------------------------------------------------

function getTopOffset() {
    if(document.all) {
	if(document.compatMode == "CSS1Compat")
	    return document.body.parentNode.scrollTop;
	else if(document.body.scrollTop)
	    return document.body.scrollTop;
	else
	    return 0;
    }
    else {
		return window.pageYOffset;
	}
}

function getWindowHeight() {
    if(window.innerHeight)
	return window.innerHeight;
    if(document.compatMode == "CSS1Compat")
	return document.body.parentNode.clientHeight;
    if(document.body.clientHeight)
	return document.body.clientHeight;	
}

PIPTag   = "";
PIPWidth = 0;

function InitPIP(tag,width){
 PIPTag   = tag;
 PIPWidth = width;
}


function PIPUpdate(){

	if(document.getElementById("adPIP") != null){
		
		var top = parseInt((getWindowHeight() - 250) + getTopOffset());
		var ad = document.getElementById("adPIP");
		top = parseInt((getWindowHeight() - 250) + getTopOffset());
		
		elem = document.getElementById(PIPTag);
		
		if(document.all) {
			left_pix = elem.offsetLeft + PIPWidth;
			ad.style.pixelLeft = left_pix;
			ad.style.pixelTop = top;
		}else{
			left_pix = elem.offsetLeft + PIPWidth;
			ad.style.left = left_pix + "px";
			ad.style.top  = top + "px";
		}
	}else{
		//alert("right=null");
	}
}

window.onload   = PIPUpdate;
window.onscroll = PIPUpdate;
window.onresize = PIPUpdate;

function FinalizePIPFlash(){

	document.getElementById('adPIP').innerHTML = "";
}

