﻿// JScript 文件
function createDIV(id,width,height,classname,html)
{
    var sLeft=0,sTop=0;
	var msie = navigator.userAgent.toLowerCase().indexOf("msie") != -1;
	var clientWidth = 0, clientHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		clientWidth = window.innerWidth;
		clientHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		clientWidth = document.documentElement.clientWidth;
		clientHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		clientWidth = document.body.clientWidth;
		clientHeight = document.body.clientHeight;
	}
	
	var sLeft = 0, sTop = 0, bWidth = 0, bHeight=0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		sTop = window.pageYOffset;
		sLeft = window.pageXOffset;
		bHeight = document.body.scrollHeight;
		bWidth = document.body.scrollWidth;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		sTop = document.body.scrollTop;
		sLeft = document.body.scrollLeft;
		bHeight = document.body.scrollHeight;
		bWidth = document.body.scrollWidth;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		sTop = document.documentElement.scrollTop;
		sLeft = document.documentElement.scrollLeft;
		bHeight = document.documentElement.scrollHeight;
		bWidth = document.documentElement.scrollWidth;
	}


    var div=document.createElement("div");
    div.className=classname;
    div.id=id;
    div.style.width=width+'px';
    div.style.height=height+'px';
    div.innerHTML="<div style='float:right;width:80px'><a href=\"javascript:removeObject('"+id+"')\"><strong>Close Window</strong></a></div>"+html;
    //var sw=window.screen.width;
    var left=(clientWidth-width)/2+sLeft;
    var top=(clientHeight-height)/2+sTop;
    div.style.left=left+'px';
    div.style.top=top+'px';
    document.body.appendChild(div);               
}
function removeObject(id)
{
    if(document.getElementById(id))
    {
        var obj=document.getElementById(id);
        document.body.removeChild(obj);
    }
}
function createTell(id)
{
    var temp="<iframe src=\"/tellfriend.aspx?id="+id+"\" scrolling=\"no\" frameborder=\"no\" width=\"580\" height=\"280\"></iframe>";
    //document.write(temp)
    createDIV('test',580,305,'divclass',temp);
}
function createVideo(id)
{
    var temp="<iframe src=\"/video/"+id+".aspx\" scrolling=\"no\" frameborder=\"no\" width=\"510\" height=\"410\"></iframe>";
    //document.write(temp)
    createDIV('test',540,440,'divclass',temp);
}
function createText(id)
{
    var temp="<iframe src=\"/getText.aspx?id="+id+"\" scrolling=\"no\" frameborder=\"no\" width=\"440\" height=\"340\"></iframe>";
    //document.write(temp)
    createDIV('test',460,360,'divclass',temp);
}
