﻿
function onClickGrown(key)
{  	
	var showContent ="<table  border='0' cellspacing='0' cellpadding='0'><tr><td><iframe cellspacing='0' cellpadding='0' name='info' frameborder='0' scrolling='no' height='150' width='300' bgcolor=E5EBCB></iframe></td></tr></table>";
	showgrown(showContent);
	try
	{
		document.all.info.src = "/blog/quickgrown.do?grownKey="+key;
	}
	catch(e)
	{
		try
		{
			top.document.all.info.src = "/blog/quickgrown.do?grownKey="+key;
		}
		catch(e)
		{
			}
	}
	
}

function do_Submit_Message()
{  	
	var showContent ="<table  border='0' cellspacing='0' cellpadding='0'><tr><td><iframe cellspacing='0' cellpadding='0' name='info' frameborder='0' scrolling='no' height='150' width='300' bgcolor=E5EBCB></iframe></td></tr></table>";
	showgrown(showContent);
	try
	{
		document.all.info.src = "/blog/test.html";
	}
	catch(e)
	{
		try
		{
			top.document.all.info.src = "/blog/test.html";
		}
		catch(e)
		{
			}
	}
	
}


/*
function onClickGrown(key){
	var ajax=new AJAXRequest;
	ajax.get(
		"/blog/quickgrown.do?grownKey="+key,
		function(obj) {
		
		
			showDivgrown("floatDiv",obj.responseText,event);
			
			document.getElementById("floatDiv").innerHTML=obj.responseText;
			
		}
	);
}
*/
function closejsp()
{

closegrown();
}

function showgrown(content)
{
	showDivgrown("floatDiv",content,event);
}

function closegrown()
{

	closeDivgrown("floatDiv");
}


var bShowDivGrown = false;
//var 

function closeDivgrown(_sID)
{
	var oObj = top.document.getElementById(_sID);

	oObj.innerHTML = "";
	oObj.style.display = "none";	
	

	//var overlay = $("overlay");	
	var overlay = top.document.getElementById("overlay");
	
	
	
	if(overlay != null)
	{
		
		overlay.outerHTML = "";
		overlay.style.display = "none";	
	}
	
	bShowDivGrown = false;
 
	top.document.body.scroll= "yes"
 ;

}

function showDivgrown(_sID,which,event,bInner,bShadow)
{			
	var arraySize;
	if(bInner==null)
		arraySize = getTopPageSizegrown();
	else
		arraySize = getPageSizegrown();
		
	var oObj = top.document.getElementById(_sID);
	
	if(oObj==null)
	{
		oObj = top.document.createElement("floatDiv");
		oObj.id = "floatDiv";    
		oObj.className = "floatDiv"; 
		oObj.style.display="none";
		top.document.body.appendChild(oObj);

	}
	oObj.innerHTML = which;
	
	if(event==null)
	{
		oObj.style.left = arraySize[0] / 2 - 150 ;
		oObj.style.top =  arraySize[3] + 200;
	
	}
	else
	{
		var iEvent= window.event ? window.event : event;	
		var arrayScroll = getPageScrollgrown();
		
		var temp = SelfXY();
		//alert("X="+temp[0]);
		//alert("Y="+temp[1]);
		
	    oObj.style.left = arraySize[0]/2-150 + arrayScroll[0];
	    oObj.style.top =  arrayScroll[1]+200;
	    //oObj.style.top =  temp[1]-75;

 

	}
		
	//鍒涘缓涓€涓狣IV,鏀瑰悕涓?overlay 杩欎釜鏄€忔槑鐨勫眰	
	if(bShadow==null)
	{
		var oDiv = top.document.createElement("div");	
		oDiv.id = "overlay";	
		top.document.body.appendChild(oDiv);

		var overlay = top.document.getElementById("overlay");
		
		overlay.style.height = arraySize[1];
		overlay.style.width = arraySize[0] + 20;
 	 // 姝ゅ鍔?0鏄洜涓轰笉鏄剧ず婊氬姩鏉″悗瀹藉害灏卞鍔犱簡20锛岄渶瑕佺敤姝ゅ眰閬斀
		
		overlay.style.display = "block";		
		overlay.style.zindex = oObj.style.zindex - 1;		
	}	
	
	oObj.style.display = "block";
	
	bShowDivGrown = true;
	//scrollMoveDiv(_sID,bInner);
	
	top.document.body.scroll="no"
}

function scrollMoveDiv(_sID,bInner)
{	
	if(bShowDivGrown)
	{
		var arraySize;
		if(bInner==null)
			arraySize = getTopPageSize();
		else
			arraySize = getPageSize();
			
		var oObj = top.document.getElementById(_sID);

		oObj.style.left = arraySize[0] / 2 - 150 ;
		oObj.style.top =  arraySize[3] + 200;
	}
	
	// 姝ゅ鏄啓姝讳簡锛屽洜涓虹洰鍓嶈皟鐢╯howdiv鍑芥暟鏃?bInner鍊奸兘鏄病鏈夌殑	
	setTimeout("scrollMoveDiv('"+_sID+"')",1);
}





function getTopPageSizegrown()
{
	var xScroll, yScroll;
	
	if(top.window.innerHeight && top.window.scrollMaxY) 
	{	
		xScroll = top.document.body.scrollWidth;
		yScroll = top.window.innerHeight + top.window.scrollMaxY;
	} 
	else if(top.document.body.scrollHeight > top.document.body.offsetHeight)
	{ 
		xScroll = top.document.body.scrollWidth;
		yScroll = top.document.body.scrollHeight;
	} 
	else 
	{ 
		xScroll = top.document.body.offsetWidth;
		yScroll = top.document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if(top.self.innerHeight) 
	{	
		windowWidth = top.self.innerWidth;
		windowHeight = top.self.innerHeight;
	} 
	else if(top.document.documentElement && top.document.documentElement.clientHeight) 
	{
		windowWidth = top.document.documentElement.clientWidth;
		windowHeight = top.document.documentElement.clientHeight;
	} 
	else if(top.document.body) 
	{
		windowWidth = top.document.body.clientWidth;
		windowHeight = top.document.body.scrollTop;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight)
	{
		pageHeight = windowHeight;
	} 
	else 
	{ 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth)
	{	
		pageWidth = windowWidth;
	} 
	else 
	{
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 

	return arrayPageSize;	
}



function getPageScrollgrown()

{
    var xScroll = document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
    
   
    var yScroll = document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;
    
    if(yScroll==0)
    {
    		yScroll = 	parent.document.body.scrollTop?parent.document.body.scrollTop:parent.document.documentElement.scrollTop;
    }

   
    
    var nScrollLeft=document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
	var nScrollTop=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
	var nClientWidth=document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth;
	var nClientHeight=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;



    var arrayScroll = new Array(nScrollLeft,yScroll);
 
   
    
    

    return arrayScroll;

}



//鍙栧緱椤甸潰澶у皬
function getPageSizegrown(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


function SelfXY(){ 
    var yScrolltop; 
    var xScrollleft; 
    if (self.pageYOffset || self.pageXOffset) { 
        yScrolltop = self.pageYOffset; 
        xScrollleft = self.pageXOffset; 
    } else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){     // Explorer 6 Strict 
        yScrolltop = document.documentElement.scrollTop; 
        xScrollleft = document.documentElement.scrollLeft; 
    } else if (document.body) {// all other Explorers 
        yScrolltop = document.body.scrollTop; 
        xScrollleft = document.body.scrollLeft; 
    } 
    arrayPageScroll = new Array(xScrollleft + event.clientX ,yScrolltop + event.clientY)  
    return arrayPageScroll; 
}


try
{
	top.document.getElementById("grownDIV").innerHTML = "";
	document.getElementById("grownDIV").innerHTML = "";
}
catch(e)
{}


