//vpu version 2010.05.28

//onresize="closegrayingbox();

//hover video block start

document.write('<div class="VPUBG none" id="VPUBG" onclick="CloseVPU()"></div>');
document.write('<div class="CloseVPUBtn none" id="CloseVPUBtn">');
document.write('<a href="javascript:CloseVPU()"><div>X CLOSE</div></a></div>');
document.write('<div class="VPU none" id="VPU">');
document.write('video-flash-img-content</div>');

//hover video block end


function getClientHeight()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}

function getClientWidth()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}


function CheckSize(_w)
{
	if(_w==undefined)_w=800;
	document.getElementById('VPUBG').style.height = document.body.scrollHeight + 'px';
	document.getElementById('VPUBG').style.width = (document.body.scrollWidth<_w?_w:document.body.scrollWidth) + 'px';
}

function CloseVPU()
{
	document.getElementById('VPU').innerHTML="";
	document.getElementById('VPUBG').style.display = 'none';
	document.getElementById('VPU').style.display = 'none';
	if(document.getElementById('CloseVPUBtn')!=null) document.getElementById('CloseVPUBtn').style.display = 'none';
}

function VPUResize(__w,__h)
{
	if(__w==undefined)__w = 600;
	if(__h==undefined)__h = 600;
	document.getElementById('VPU').style.width = __w + 'px';
	document.getElementById('VPU').style.height = __h + 'px';

	var top = (self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop)) + (getClientHeight()-__h)/2
	if(top<0) top=0;
	document.getElementById('VPU').style.top = top+'px';

	var left = (getClientWidth()-__w)/2
	if(left<0) left=0;
	document.getElementById('VPU').style.left = left+'px';

	if(document.getElementById('CloseVPUBtn')!=null){
		document.getElementById('CloseVPUBtn').style.top = (self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop)) + (getClientHeight()-__h)/2 - 10 +'px';
		document.getElementById('CloseVPUBtn').style.left = getClientWidth()/2+__w/2 - 50 +'px';
		}
}

function OpenVPU(_type,_src,_w,_h,_desc)
{
	var Chars=55;
	if(_desc=='') _desc=" &nbsp; &nbsp;";
	if(_desc==undefined) _desc=" &nbsp; &nbsp;";
	document.getElementById('VPUBG').style.display = 'block';
	document.getElementById('VPU').style.display = 'block';
	if(document.getElementById('CloseVPUBtn')!=null) document.getElementById('CloseVPUBtn').style.display = 'block';
	CheckSize(980);  // check width

	if(_type=='img'){
	document.getElementById('VPU').className='VPU';
	VPUResize(_w,_h);
	document.getElementById('VPU').innerHTML='<a href="javascript:CloseVPU();"><img src="'+_src+'" height="'+_h+'" width="'+_w+'" alt="'+ _desc +'"></a>';
	}

	if(_type=='iframe'){
	document.getElementById('VPU').className='VPU blue';
	if(document.getElementById('CloseVPUBtn')!=null) document.getElementById('CloseVPUBtn').style.display = 'none';
	VPUResize(_w,_h);
	var tmp_str='';
	tmp_str+='<div class="VPUhead">';
	tmp_str+='<table cellpadding="0" cellspacing="0" border="0" width="'+(_w-20)+'">';
	tmp_str+='<tr><td><h1 class="nomargin">'+_desc+'</h1></td><td class="print_td"><a href="javascript:document.getElementById(\'iframe\').contentWindow.focus();javascript:document.getElementById(\'iframe\').contentWindow.print();"><div>PRINT</div></a></td><td class="close_td"><a href="javascript:CloseVPU()"><div>CLOSE</div></a></td></tr>';
	tmp_str+='</table>';
	tmp_str+='</div>';
	if(_desc.length>47) mif=90; else mif=55;
	tmp_str+='<iframe frameborder="0" scrolling="auto" src="'+_src+'" width="'+_w+'" id="iframe" height="'+(_h-mif)+'"></iframe>';
	document.getElementById('VPU').innerHTML=tmp_str;
	}
	if(_type=='iframeclear'){
	VPUResize(_w,_h);
	var tmp_str='';
	tmp_str+='<iframe scrolling="auto" frameborder="0" src="'+_src+'" width="'+_w+'" id="iframe" height="'+_h+'"></iframe>';
	document.getElementById('VPU').innerHTML=tmp_str;
	}

	return false;
}

function CheckVPU(){
	if(window.location.search!="")
	{
	var tmp_str=window.location.search;
	var tmp_str1=tmp_str.substring(1,tmp_str.length);
	if(document.getElementById(tmp_str1)!=""){
		tmp_str = document.getElementById(tmp_str1).innerHTML;
		tmp_str1=tmp_str.substring(tmp_str.indexOf('href=')+6,tmp_str.length);
		tmp_str2=tmp_str.substring(tmp_str.indexOf("'820','400','")+13,tmp_str.length);
		desc=tmp_str2.substring(0,tmp_str2.indexOf("'"));
		link=tmp_str1.substring(0,tmp_str1.indexOf('"'));
		if(tmp_str!="#"){window.scroll(0,-100);OpenVPU('iframe',link,820,400,desc);}
		}
	}
}

