

var PrintMagic2009Nenga_timer,PrintMagic2009Nenga_loadflag;

function PrintMagic2009Nenga_Resize(){
	
	var arrayPageSize = PrintMagic2009Nenga_getPageSize();
	
	document.getElementById("PrintMagic2009Nenga_box2").style.height= arrayPageSize[3] + 'px';
	document.getElementById("PrintMagic2009Nenga_box2").style.width =arrayPageSize[2] + 'px';
	
	PrintMagic2009Nenga_timer = setTimeout("PrintMagic2009Nenga_Resize();",250);
	
}
function PrintMagic2009Nenga_InitPos(){
	var arrayPageSize = PrintMagic2009Nenga_getPageSize();
	var arrayPageScroll = PrintMagic2009Nenga_getPageScroll();
	
	document.getElementById("PrintMagic2009Nenga_box2").style.top =arrayPageScroll[1]+20+"px";
	document.getElementById("PrintMagic2009Nenga_box").style.height = arrayPageSize[1] + 'px';
	document.getElementById("PrintMagic2009Nenga_box").style.width  = arrayPageSize[0] + 'px';
	
}
function PrintMagic2009Nenga_Viewer(){
	
	var tag='<IMG src="http://2009nenga.print-magic.net/img.php?uid='+printmagic_2009_uid+'" class=PrintMagic2009Nenga_image>';
	if(PrintMagic2009Nenga_loadflag == 1){
		PrintMagic2009Nenga_InitPos();
		PrintMagic2009Nenga_Resize();
		document.getElementById("PrintMagic2009Nenga_box_tag").innerHTML=tag;
		document.getElementById("PrintMagic2009Nenga_box2").style.visibility="visible";
		document.getElementById("PrintMagic2009Nenga_box").style.visibility="visible";
	}else{
		setTimeout("PrintMagic2009Nenga_Viewer();",300);
	}
	return false;
}
function PrintMagic2009Nenga_C(){
	clearTimeout(PrintMagic2009Nenga_timer);
	document.getElementById("PrintMagic2009Nenga_box2").style.visibility=document.getElementById("PrintMagic2009Nenga_box").style.visibility="hidden";
	document.getElementById("PrintMagic2009Nenga_box_tag").innerHTML="";
	return false;
}
onload=function () {

var ob_Body = document.getElementsByTagName("body").item(0);

var ob_box = document.createElement("div");
ob_box.setAttribute('id','PrintMagic2009Nenga_box');
ob_Body.insertBefore(ob_box, ob_Body.firstChild);

var ob_box2 = document.createElement("div");
ob_box2.setAttribute('id','PrintMagic2009Nenga_box2');
ob_Body.insertBefore(ob_box2, ob_Body.firstChild);

var ob_box_inner = document.createElement("div");
ob_box_inner.setAttribute('id','PrintMagic2009Nenga_box_inner');
ob_box2.appendChild(ob_box_inner);

var ob_box_tag = document.createElement("div");
ob_box_tag.setAttribute('id','PrintMagic2009Nenga_box_tag');
ob_box_inner.appendChild(ob_box_tag);

ob_box2.onclick = function () {return PrintMagic2009Nenga_C();}

PrintMagic2009Nenga_loadflag=1;
}
function PrintMagic2009Nenga_getPageSize(){
	
	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;
	}
	var arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
function PrintMagic2009Nenga_getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

document.write('<link href="http://2009nenga.print-magic.net/style.css" rel="stylesheet" type="text/css">');

document.write(
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="120" height="180" id="geobp" align="middle">'+
	'<param name="allowScriptAccess" value="always" />'+
	'<param name="allowFullScreen" value="false" />'+
	'<param name="movie" value="http://www.print-magic.net/blogparts_test/parts.swf" />'+
	'<param name="FlashVars" value="uid='+printmagic_2009_uid+'" />'+
	'<param name="quality" value="high" />'+
	'<param name="wmode" value="transparent" />'+
	'<embed src="http://www.print-magic.net/blogparts_test/parts.swf" FlashVars="uid='+printmagic_2009_uid+'" quality="high" wmode="transparent" width="120" height="180" name="printmagic" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
	'</object>'
);
