var wArray ="";
var winopened;
var checkwin = true;


function printView(lang) {
	mWidth2 = (screen.availWidth/2) - (600/2);
	mHeight2 = (screen.availHeight/2) - (500/2);

	wArray = window.open("","printview","scrollbars=yes,menubar=yes,width=600,height=500,left="+mWidth2+",top="+mHeight2)
	wArray.document.open()
	wArray.document.writeln("<HTML>")
	wArray.document.writeln("<HEAD>")
	if(lang=="en"){
		wArray.document.writeln("<TITLE>Printer Friendly Page</TITLE>")
	}
		else if (lang=="zh")
	{
		wArray.document.writeln("<TITLE>打印版本</TITLE>")
	}
		else if (lang=="fr")
	{
		wArray.document.writeln("<TITLE>Version Texte</TITLE>")
	}
	wArray.document.writeln("<script>")
	wArray.document.writeln("function DisableEnableForm(xForm,xHow){")
	wArray.document.writeln("if(xForm){")
	wArray.document.writeln("objElems = xForm.elements;")
	wArray.document.writeln("for(i=0;i<objElems.length;i++){")
	wArray.document.writeln("objElems[i].disabled = xHow;")
	wArray.document.writeln("}}}")
	wArray.document.writeln("</script>")
	wArray.document.writeln("<style>")
	wArray.document.writeln("body{margin:10px;font-family:arial;font-size:12px;}")
	wArray.document.writeln("#topimg{display:none;}")
	wArray.document.writeln("#backimg{display:none;}")
	wArray.document.writeln("td{font-family:arial;font-size:12px;color: #000000;}")
	wArray.document.writeln("#pageheader{font-size: 20px;}");
	wArray.document.writeln(".subheader1{font-size: 15px;}");
	wArray.document.writeln("a, a:active, a:visited, a:hover {color: #000000;text-decoration:none;cursor:text;}");
	wArray.document.writeln(".photoTable{border:1px solid #cccccc;width:150px;}")
	wArray.document.writeln(".photoCell{padding:4px;}")
	wArray.document.writeln(".photoContent{padding:0px 4px 4px 4px;font-size:11px;vertical-align:top;height:60px;}")
	wArray.document.writeln(".photoContentHidden{padding:0px 4px 4px 4px;font-size:11px;vertical-align:top;display:none;}")
	wArray.document.writeln(".photoFooter{display:none}")
	wArray.document.writeln(".cell{background-color:#e4e4e4;height:20px;}")
	wArray.document.writeln(".alphaTable{background-color:#ffffff;border:1px solid #000000;color:#000000;}")
	wArray.document.writeln(".alphaTable2{background-color:#ffffff;border:1px solid #cccccc;color:#000000;}")
	wArray.document.writeln(".cellPadding{padding-bottom: 10px;}")
	wArray.document.writeln(".cellPadding2{padding-left: 10px;}")
	wArray.document.writeln(".printNone{display:none;}")
	wArray.document.writeln("</style>")
	wArray.document.writeln("<BASE TARGET=\"main\">")
	wArray.document.writeln("</HEAD>")
	wArray.document.writeln("<BODY  leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' onclick='return false;' onload='DisableEnableForm(document.forms[0],true)'>")
	wArray.document.writeln("<form><div id='parentDiv'>")
	wArray.document.writeln("<img src='"+ getTitleImg(document.getElementById("titleimg").src, lang)+"' />")
	wArray.document.writeln("<hr>")
	wArray.document.writeln("<div id='pageheader'>"+document.getElementById("pageheader").innerHTML+"</div>")
	wArray.document.writeln(document.getElementById("content").innerHTML)
	wArray.document.writeln("<hr>")
	if(lang=="en"){
		wArray.document.writeln("Copyright 2006 ?United Nations");
	}
		else if (lang=="zh")
	{
		wArray.document.writeln("联合国版权所有&copy;2008年");
	}
		else if (lang=="fr")
	{
		wArray.document.writeln("Droits d'auteur 2006 ?ONU");
	}
	wArray.document.writeln("</div></form>")
	wArray.document.writeln("</BODY>")
	wArray.document.writeln("</HTML>")
	wArray.document.close()
	wArray.focus()
}

function getTitleImg(a,lang){
	var src =  a;
	var osrc = "img_title_"+lang+".jpg";
	var nsrc = "img_title_print_"+lang+".jpg";
	src = src.replace(osrc, nsrc)
	return src;
}



function photoView(a){
	var tmsrc = a+"_tm";
	var osrc = document.getElementById(a).src;
	imgId = a+"_text";
	var imgContent = document.getElementById(imgId).innerHTML;
	var nsrc = "jpg/"+a;
	var src = osrc.replace(tmsrc, nsrc);
	document.location.href = "preview/photogallery_preview.html?previewImg="+src+"&a="+a+"&imgContent="+imgContent;
}
