/*
* Copyright 2008 juedui100
* identify usermatch
*/

function $(){return document.getElementById(arguments[0]) || false ;}

function Init_Age(start_age,end_age)
{
//	if(start_age >=18 && start_age<=77 )
//		$("mage_star").selectedIndex=start_age-17;
//	if(end_age >=18 && end_age<=77 && end_age > start_age)
//		$("mage_end").selectedIndex=end_age-17;		
	if(start_age <= 20){
		 $("mage_star").value = 20;
	}else{
		 $("mage_star").value = start_age;
	}
	if(end_age >= 77){
  		 $("mage_end").value = 77;
  	}else{
  		 $("mage_end").value = end_age;	
  	}
}
function Init_Height(start_height,end_height)
{
/**
	if(start_height >=141 && start_height<=260 )
		$("mheight_star").selectedIndex=start_height-140;
	if(end_height >=141 && end_height<=260 && end_height > start_height)
		$("mheight_end").selectedIndex=end_height-140;	
**/
	if(start_height <= 130){
		$("mheight_star").value = 130;
	}else{
		$("mheight_star").value = start_height;
	}
	if(end_height >= 230){
		$("mheight_end").value = 230;
	}else{
		$("mheight_end").value = end_height;
	}

}
function Init_Province(province)
{
	if(province != 0 && province != 83)
	{
		var provincelist = eval("prov.split(',')");
		var codelist = eval("code.split(',')");
		for(var i=1; i<provincelist.length+1; i++)
		{
			if(codelist[i-1] == province )
			{
				$("province").selectedIndex=i;
				return;
			}
		}	
	}
}
function Init_Education(education)
{
	if(education =='1')
	{
		$("education").selectedIndex=1;
		$("degree_more_than").checked = true;
		$("degree_more_than").disabled = false;
	}
	if(education =='2')
	{
		$("education").selectedIndex=2;
		$("degree_more_than").checked = true;
		$("degree_more_than").disabled = false;
	}
}

function setMage_end(age_star){	
	var optionStr = '<select id="mage_end" name="mage_end" style="width:80px;"><option value="0" selected>--不限--</option>'; 
	if(age_star == 0) age_star = 18;
	for(var i=age_star;i<=77;i++){
		optionStr += '<option value="'+i+'">'+i+'</option>';
	}		
	optionStr += "</select>";
	$("mage_end").outerHTML = optionStr;
}
function setMheight_end(height_star){	
	var optionStr = '<select id="mheight_end" name="mheight_end" style="width:80px;"><option value="0" selected>--不限--</option>'; 
	if(height_star == 0) height_star = 141;
	for(var i=height_star;i<=260;i++){
		optionStr += '<option value="'+i+'">'+i+'</option>';
	}		
	optionStr += "</select>";
	$("mheight_end").outerHTML = optionStr;
}

function judgeDegree(education){
	if(education != '0'){
		$("degree_more_than").disabled = false;
	}else{
		$("degree_more_than").checked = false;
		$("degree_more_than").disabled = true;
	}
}

function sub()
{
	document.regForm.submit();	
}

