// JavaScript Document
// (C)2006 Dafnielle
// 01media presents

function popupGraph(url){
	window.open(url,'_blank','width=900,resizable=1,scrollbars=1');
}

function closeWindow(){
	opener='_dummy';
	window.close();
}


// Form checking codes
// JPEG Interactive Presents

_hilight_style='text-strong-red';

function reset_form(){
	if(confirm('表单里的所有数据将被清空\n确认重置表单?'))
		window.location.reload(false);
	else return false;
}

function check_field(name){
	if(eval('document.inquiry.'+name).value==''){
		_empty++;
		document.getElementById('span_'+name).className=_hilight_style;
	}
	else
		document.getElementById('span_'+name).className='';
}

function check_radio(name){
	var n,_selected='';
	for(n=0;n!=eval('document.inquiry.'+name).length;n++)
		if(eval('document.inquiry.'+name)[n].checked)
			_selected=eval('document.inquiry.'+name)[n].value;
	document.getElementById('span_'+name).className=_selected==''?_hilight_style:'';
}

function checkform_join(){
	_empty=0;
	check_field('name');
	check_field('age');
	check_field('education');
	check_field('address');
	check_field('from');
	check_field('store_region');
	check_field('tel');
	check_field('mobile');
	check_field('zip');
	check_radio('gender');
	check_radio('investing');
	check_radio('experience');
	check_radio('plan');
	if(_empty!=0)
		alert_form();
	return (_empty==0);
}

function alert_form(){
	alert('*所有带星号的项目必须填写\n否则表单不能提交');
}

function checkform_hr(){
	_empty=0;
	check_field('name');
	check_radio('gender');
	check_field('birthday');
	check_radio('marriage');
	check_field('nationality');
	check_field('height');
	check_field('weight');
	check_field('education');
	check_field('from');
	check_field('college');
	check_field('major');
	check_field('pace_living');
	check_field('salary');
	check_field('date_duty');
	check_field('tel');
	check_field('mobile');
	check_field('email');
	check_field('educational_history');
	check_field('working_history');
	check_field('advantage');
	check_field('computer_ability');
	if(_empty!=0){
		alert_form();
		return false;
	}
	if(!document.inquiry.agree.checked)
		{
			alert('必须接受特别说明\n否则表单不能提交');
			return false;
		}
	return (_empty==0);
}

function QueryString()
{
  var name,value,i;
  var str=location.href;
  var num=str.indexOf("?")
  str=str.substr(num+1);
  var arrtmp=str.split("&");
  for(i=0;i < arrtmp.length;i++)
  {
    num=arrtmp[i].indexOf("=");
    if(num>0)
    {
      name=arrtmp[i].substring(0,num);
      value=arrtmp[i].substr(num+1);
      this[name]=value;
    }
  }
}

var Request=new QueryString();

