var printWin = self.window.name;
if(printWin == 'win1'){
	document.write ('<link href="/common/css/print.css" rel="stylesheet" type="text/css" media="all" />');
	document.write ('<link href="/common/css/print2.css" rel="stylesheet" type="text/css" media="print" />');
}

function OpenWin(){
	myWin = window.open("/cpark/print.do?path=" + location.pathname + location.search.replace(/\?/g, '%3f').replace(/&/g, '%26'),"win1","toolbar=no,location=yes,status=no,menubar=no,scrollbars=yes,resizable=yes,dependent=yes,directories=no,width=804,height=530");
}

function PrintWin(){
	if(printWin == 'win1'){
		setTimeout('window.print()',500);
	}
}
window.onload=ROfunction;new function(){PrintWin();}






var saveTime = 10*24*60*60*1000;
var nowCookie = getcookie ();

if(nowCookie == "l"){
	if(os=="win" && agent.indexOf("Firefox")!=-1){
		document.write ('<style type="text/css">body{font-size:118%;}</style>');
	}else{
		document.write ('<style type="text/css">body{font-size:118%;}</style>');
	}
}

if(nowCookie == "s"){
	if(os=="win" && agent.indexOf("Firefox")!=-1){
		document.write ('<style type="text/css">body{font-size:80%;line-height:120%;}</style>');
	}else{
		document.write ('<style type="text/css">body{font-size:80%;line-height:120%;}</style>');
	}
}

function fontmenu() {
	document.write ('<div>');
	if(printWin == 'win1'){document.write ('<p><a href="#"  title="打印" onclick="PrintWin(); return false;">打印</a></p>');}
	if(printWin != 'win1'){document.write ('<p><a href="#"  title="打印" onclick="OpenWin(); return false;">打印</a></p>');}
	document.write ('<dl>');
	document.write ('<dt>字体大小</dt>');
	if(nowCookie == 's'){
		document.write ('<dd class="font-s" title="小"><a href="javascript:location.reload();" class="hover">小</a></dd>');
	}else{
		document.write ('<dd class="font-s"><a href="javascript:location.reload();" onclick="javascript:setcookie (\'s\')" title="小">小</a></dd>');
	}
	if(nowCookie != 'l' && nowCookie != 's'){
		document.write ('<dd class="font-m" title="中"><a href="javascript:location.reload();" class="hover">中</a></dd>');
	}else{
		document.write ('<dd class="font-m"><a href="javascript:location.reload();" onclick="javascript:setcookie (\'m\')" title="中">中</a></dd>');
	}
	if(nowCookie == 'l'){
		document.write ('<dd class="font-l" title="大"><a href="javascript:location.reload();" class="hover">大</a></dd>');
	}else{
		document.write ('<dd class="font-l"><a href="javascript:location.reload();" onclick="javascript:setcookie (\'l\')" title="大">大</a></dd>');
	}
	document.write ('</dl>');
	document.write ('</div>');
}

function fontmenu02() {
	document.write ('<div>');
	document.write ('<dl>');
	document.write ('<dt>字体大小</dt>');
	if(nowCookie == 's'){
		document.write ('<dd class="font-s" title="小"><a href="javascript:location.reload();" class="hover">小</a></dd>');
	}else{
		document.write ('<dd class="font-s"><a href="javascript:location.reload();" onclick="javascript:setcookie (\'s\')" title="小">小</a></dd>');
	}
	if(nowCookie != 'l' && nowCookie != 's'){
		document.write ('<dd class="font-m" title="中"><a href="javascript:location.reload();" class="hover">中</a></dd>');
	}else{
		document.write ('<dd class="font-m"><a href="javascript:location.reload();" onclick="javascript:setcookie (\'m\')" title="中">中</a></dd>');
	}
	if(nowCookie == 'l'){
		document.write ('<dd class="font-l" title="大"><a href="javascript:location.reload();" class="hover">大</a></dd>');
	}else{
		document.write ('<dd class="font-l"><a href="javascript:location.reload();" onclick="javascript:setcookie (\'l\')" title="大">大</a></dd>');
	}
	document.write ('</dl>');
	document.write ('</div>');
}


function getcookie(){
	var ReturnsNum = Num = NumbarNum = 0;
	var cookieNameEx = "CanonCreativeParkFontData" + "=";
	var stTemp = "";
	while (Num < document.cookie.length){
		NumbarNum = Num + cookieNameEx.length;
		if (document.cookie.substring(Num, NumbarNum) == cookieNameEx){
			stTemp = document.cookie.indexOf(";", NumbarNum);
			if (stTemp == -1){
				ReturnsNum = document.cookie.substring(NumbarNum, document.cookie.length);
			}else{
				ReturnsNum = document.cookie.substring(NumbarNum, stTemp);
			}
			break;
		}
		Num = document.cookie.indexOf(" ", Num) + 1;
		if (Num == 0){break;}
	}
	return ReturnsNum;
}



function setcookie(setValue){
	var domaintoken = window.location.host.split(".");
	var domainname = "";
	
	if (domaintoken.length >= 2) {
		domainname = domaintoken[domaintoken.length - 2] + "." + domaintoken[domaintoken.length - 1];
	} else {
		domainname = window.location.host;
	}

	var dateEx = new Date();
 	dateEx.setTime(dateEx.getTime() + saveTime);
	document.cookie = "CanonCreativeParkFontData" + "=" + setValue + "; expires=" + dateEx.toGMTString() + ";path=/; domain=" + domainname;
}
