// JavaScript Document
function show_calendar(object_name)
{
   var obj_form=eval("document."+form_name);

	 if(obj_form.calendar_is_opened.value=="true")
	 {
		 alert("Please close the other calendar window.");
		 return;
	 }

	 obj_form.calendar_is_opened.value=true;
	 obj_form.object_name.value=object_name;
	 obj=document.getElementById(object_name+"_calbox");
	 //obj.style.display="inline";
   if(document.getElementById(object_name+"_calframe"))
	 {
		 document.getElementById(object_name+"_calframe").className="calframe";
	 }
	 else
	 {
	   obj.innerHTML="<iframe  name='"+object_name+"_calframe' id='"+object_name+"_calframe'  class='calframe' scrolling='no' marginheight='0' marginwidth='0' frameborder='0'></iframe>";
	   //obj_calframe=document.getElementById(object_name+"_calframe");

	   eval(object_name+"_calframe").document.open();

	   frame_html="<html>";
	   frame_html+="<head>";
	   frame_html+="<title>Calendar</title>";
	   frame_html+="<style type='text/css'>";
	   frame_html+="@import url(\"includes/calendar.css\");";
	   frame_html+="</style>";
	   frame_html+="<script language='javascript' type='text/javascript' src='includes/calendar.js'></script>\r\n";
	   frame_html+="<script language='javascript'>\r\n";
		 frame_html+="var parent_form_name=\"parent.document."+form_name+"\";\r\n";
		 frame_html+="</script>";

	   frame_html+="</head>";

  	 frame_html+="<body>";

	   frame_html+="<a href='javascript:close_calendar();' style='margin:0;text-decoration:none;text-align:right;'><img src='images/close.gif' align='right' border='0'></a><br><br>";
	   frame_html+="<center>";
	   frame_html+="<div id='calendar'>";
	   frame_html+="</div>";
	   frame_html+="</center>";
	   frame_html+="</body>";
	   frame_html+="</html>";
	   eval(object_name+"_calframe").document.write(frame_html);
	   eval(object_name+"_calframe").document.close();
	 }
}
function check_date(obj)
{
	if(obj.value=="yyyy/mm/dd")
	{
		obj.value='';
	}
}
function check_form()
{
  if(document.application_form.first_name.value=="")
	{
	  alert("Please enter your first name.");
		return false;
	}
  if(document.application_form.last_name.value=="")
	{
	  alert("Please enter your last name.");
		return false;
	}
	return true;
}

function check_country()
{
 //alert(document.application_form.country_citizenship.options[document.application_form.country_citizenship.selectedIndex].value);
  if(document.application_form.country_citizenship.options[document.application_form.country_citizenship.selectedIndex].value=='US')
  {
    document.application_form.us_permanent_resident.disabled=true;
    document.application_form.us_permanent_resident[0].disabled=true;
    document.application_form.us_permanent_resident[1].disabled=true;
  }
  else
  {
    document.application_form.us_permanent_resident.disabled=false;
    document.application_form.us_permanent_resident[0].disabled=false;
    document.application_form.us_permanent_resident[1].disabled=false;
  }
}


function check_position_other()
{
  if(document.application_form.position_id!=null)
  {
    if(document.application_form.position_id.selectedIndex==7)
    {
      document.getElementById("position_other").style.display="inline";
    }
    else
    {
      document.getElementById("position_other").style.display="none";
      document.application_form.position_other_explain.value='';
    }
  }
}

