﻿var winWidth = 0; 
var winHeight = 0; 
window_height = 0;
window_width = 0;

function findDimensions() //函数：获取尺寸
{ 
	//获取窗口宽度 
	if (window.innerWidth) 
		winWidth = window.innerWidth; 
	else if ((document.body) && (document.body.clientWidth)) 
		winWidth = document.body.clientWidth; 

	//获取窗口高度 
	if (window.innerHeight) 
		winHeight = window.innerHeight; 
	else if ((document.body) && (document.body.clientHeight)) 
		winHeight = document.body.clientHeight; 

	//通过深入Document内部对body进行检测，获取窗口大小 
	if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth){ 
		winHeight = document.body.clientHeight; 
		winWidth = document.documentElement.clientWidth; 
	} 

	winHeight_2 = document.body.scrollHeight;
	
	//刷新背景
	document.getElementById("background").style.top = 0 +"px";
	document.getElementById("background").style.left = 0 +"px";
	document.getElementById("background").style.width = winWidth +"px";
	document.getElementById("background").style.height = winHeight_2 +"px";
	//刷新窗口位置
	document.getElementById("window").style.height = window_height +"px";
	document.getElementById("window").style.width = window_width +"px";
	document.getElementById("window").style.top = (winHeight - window_height)/2>20?(winHeight - window_height)/2+"px": 20+"px";
	document.getElementById("window").style.left = (winWidth - window_width)/2 +"px";
	
} 



//调用函数，获取数值 



function closewindow(){
	window.onresize="";
	document.getElementById("engine").src= "about:blank";
	document.getElementById("background").style.display = "none";
	document.getElementById("window").style.display = "none";
}



function jumpwindow(strTemp){
	scroll(0,0);
	window.onresize=findDimensions;
	
	document.getElementById("background").style.display = "";
	document.getElementById("window").style.display = "";
	document.getElementById("engine").src = strTemp;
	//findDimensions();
}

function changewindowsize(w,h){
	window_height = h;
	window_width = w;
	document.getElementById("engine").width=w-12;
	document.getElementById("engine").height=h-25;
	findDimensions();
	refIframe('loading');
}

function jumpwithoutwindow(strTemp){
	document.getElementById("engine").src = strTemp;
}

function refIframe (sw) {
	switch (sw)
	{
		case 'loading':
			document.getElementById('engine').style.visibility='hidden';
			document.getElementById('window').style.background ='url(Public/images/loading.gif) no-repeat center center';
			document.getElementById('window').style.backgroundColor = '#ffffff';
			break;
		case 'sending':
			window.top.document.getElementById('engine').style.visibility='hidden';
			window.top.document.getElementById('window').style.background ='url(Public/images/sending.gif) no-repeat center center';
			window.top.document.getElementById('window').style.backgroundColor = '#ffffff';
			
			break;
		case 'onload':
			document.getElementById('engine').style.visibility='visible';
			break;
	}
	
}
document.write('<div style=" position : absolute;background-color : black;z-index : 1;visibility : visible;filter:alpha(opacity=50);/* IE */ -moz-opacity:0.5;/* Moz + FF */ opacity: 0.5;/* 支持CSS3的浏览器（FF 1.5也支持）*/ " id="background" onclick="javascript://closewindow();" ></div>');
document.write('<div style="width : 100px;height : 100px;top : -1050px;left : -500px;position : absolute;background-color : #ffffff;z-index : 1;visibility : visible;border-width : 5px;border-style : solid;border-color : #666;" id="window"><p align="right" style="font-size:12px;margin:3px 3px 3px 0;"><a href="javascript:void(0);" onclick="javascript:closewindow();" style="color:#000;text-decoration : none;font-weight : bold;font-family:宋体;">×</a></p><center><IFRAME id="engine" width="370" height="200" marginwidth="0" marginheight="0" hspace="0" vspace="0"   frameborder="0" scrolling="no" src="about:blank" class="engineIframe" name="engine2" align="absmiddle" style="visibility:hidden;background-color:#ffffff;" onload="javascript:refIframe(\'onload\')"></IFRAME></center></div>');




/*
	for action sendmsg
	*/

function sendmsg () {
	refIframe('sending');
	document.submit_form.submit();
	

}
function sendmsg2 () {
	refIframe('sending');
	document.submit_form2.submit();
	

}
function complete () {
	alert(ThinkAjax.updateTip);
}

















//menu
var subcat=new Array(); 
var biglist=new Array('家具/日用品','家用电器','商用/办公','电脑/笔记本/耗材','图书/音乐/运动','手机/通讯相关','电子数码','服饰/箱包/化妆品','其它');
subcat[0]=new Array('0','其它','23');
subcat[1]=new Array('0','床/床垫','19');
subcat[2]=new Array('0','柜子/架子','20');
subcat[3]=new Array('0','沙发桌/椅','21');
subcat[4]=new Array('0','日用品','22');
subcat[5]=new Array('1','其它','32');
subcat[6]=new Array('1','电视','24');
subcat[7]=new Array('1','冰箱','25');
subcat[8]=new Array('1','洗衣机','26');
subcat[9]=new Array('1','空调','27');
subcat[10]=new Array('1','微波炉','28');
subcat[11]=new Array('1','厨卫电器','29');
subcat[12]=new Array('1','小型电器','30');
subcat[13]=new Array('1','音响/DVD','31');
subcat[14]=new Array('2','其它','36');
subcat[15]=new Array('2','办公家具','33');
subcat[16]=new Array('2','二手设备/耗材','34');
subcat[17]=new Array('2','机械/五金','35');
subcat[18]=new Array('3','其它','42');
subcat[19]=new Array('3','笔记本','37');
subcat[20]=new Array('3','硬件配件','38');
subcat[21]=new Array('3','上网本','39');
subcat[22]=new Array('3','台机整机','40');
subcat[23]=new Array('3','网络设备','41');
subcat[24]=new Array('4','其它','47');
subcat[25]=new Array('4','图书','43');
subcat[26]=new Array('4','乐器','44');
subcat[27]=new Array('4','音像','45');
subcat[28]=new Array('4','运动','46');
subcat[29]=new Array('5','其它','52');
subcat[30]=new Array('5','手机','48');
subcat[31]=new Array('5','手机号','49');
subcat[32]=new Array('5','手机配件','50');
subcat[33]=new Array('5','充值卡','51');
subcat[34]=new Array('6','其它','58');
subcat[35]=new Array('6','相机','53');
subcat[36]=new Array('6','摄像机','54');
subcat[37]=new Array('6','游戏机/psp','55');
subcat[38]=new Array('6','MP3/MP4/ipod','56');
subcat[39]=new Array('6','存储卡','57');
subcat[40]=new Array('7','其它','64');
subcat[41]=new Array('7','箱包','59');
subcat[42]=new Array('7','服装','60');
subcat[43]=new Array('7','鞋帽','61');
subcat[44]=new Array('7','化妆品','62');
subcat[45]=new Array('7','饰品','63');
subcat[46]=new Array('8','其它','67');
subcat[47]=new Array('8','古玩','65');
subcat[48]=new Array('8','礼品','66');


function changeselect1(locationid) 
{ 
for(j=0;j<biglist.length;j++)   
if(biglist[j]==locationid){
locationid=j;
}
document.submit_form.smallclass.length=0;//初始化下拉列表，清空下拉数据 
//document.submit_form.smallclass.options[0]=new Option('所有小类','所有小类');//给第一个值 
for(i=0;i<subcat.length;i++) 
{ 
if(subcat[i][0]==locationid) 
{
document.submit_form.smallclass.options[document.submit_form.smallclass.length]=new Option(subcat[i][1],subcat[i][2]);}//建立option 
} 
} 

