function  get_course_field(g)
{
	document.forms['phpform'].cours_sel.options.length = 1;
	document.forms['phpform'].cours_sel.options[0].value=0;
	document.forms['phpform'].cours_sel.options[0].text="waiting ...";
	
	if(g.selectedIndex==0)
	{
		document.forms['phpform'].cours_sel.options[0].text="یک رشته را انتخاب نمایید ";
	return false;
	}
	var myerer=g.options[g.selectedIndex].value;
	//show('mask_window');
	
	htmlRequest =ajaxall();
	//alert(htmlRequest);
	if (htmlRequest==null){ // If it cannot create a new Xmlhttp object.
		alert ("Browser does not support HTTP Request");
		return;
	} 
	htmlRequest.onreadystatechange = function(){
		if(htmlRequest.readyState == 4){
			document.getElementById("panel_course_sel").innerHTML = htmlRequest.responseText;
			// alert(htmlRequest.responseText);
			// hide('mask_window');
		}
	}
	htmlRequest.open('POST', '/include/med_ajaxx_call.php');//get filed from report
	htmlRequest.setRequestHeader("Method", "POST /include/med_ajaxx_call.php HTTP/1.1");
	htmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	htmlRequest.setRequestHeader("Connection", "close");
	var myurl;
	myurl='func=show_course_by_course_type&ajaxcall=true&arg='+myerer+'&contact=test';//+document.shoutbox.shouter_contact.value;
	//alert(myurl);
	htmlRequest.send(myurl); 
	}
	function check_user_name()
	{
		var user_name=document.forms['phpform'].user.value;
		var res="";
		if(user_name=="")
		{
		return false;
		}
		if(user_name.length<4)
		{
			show_my_msg("کلمه کاربری از 4حرف باید بزرگتر باشد");
			return false;
		}
		htmlRequest =ajaxall();
	//alert(htmlRequest);
	if (htmlRequest==null){ // If it cannot create a new Xmlhttp object.
		alert ("Browser does not support HTTP Request");
		return;
	} 
	document.getElementById("s_user_img_load").style.visibility="visible";
	htmlRequest.onreadystatechange = function(){
		if(htmlRequest.readyState == 4){
			//document.getElementById("panel_course_sel").innerHTML = htmlRequest.responseText;
			 //alert(htmlRequest.responseText);
			 res=htmlRequest.responseText;
			 res=trim(res);
			 if(res=='true' || res==true){
			 document.forms['phpform'].user.value="";	
			 document.getElementById("s_user_msg").innerHTML="این نام کاربری قبلا انتخاب شده است";
			 document.getElementById("user_tr_tab").className="item_not_acept";
			 document.getElementById("s_user_img_not_accpet").style.visibility="visible";
		     document.getElementById("s_user_img_accpet").style.visibility="hidden";
			 }else{
			document.getElementById("s_user_msg").innerHTML="";
			 document.getElementById("s_user_img_accpet").style.visibility="visible";
			 document.getElementById("s_user_img_not_accpet").style.visibility="hidden";
			 document.getElementById("user_tr_tab").className="";
			 }
		 			// hide('mask_window');
			document.getElementById("s_user_img_load").style.visibility="hidden";
		}
	}
	htmlRequest.open('POST', '/include/med_ajaxx_call.php');//get filed from report
	htmlRequest.setRequestHeader("Method", "POST /include/med_ajaxx_call.php HTTP/1.1");
	htmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	htmlRequest.setRequestHeader("Connection", "close");
	var myurl;
	myurl='func=check_uniq_user_name&ajaxcall=true&arg='+user_name+'&contact=test';
	//alert(myurl);
	htmlRequest.send(myurl); 
	
	} 
	function check_require_(elem,image_id,msg){
		
		 document.getElementById(image_id).style.visibility="visible";
		if( document.getElementById(elem).value=="")
		{
document.getElementById(image_id).src="/images/bg/icon4.gif";		
	document.getElementById("l_"+image_id).innerHTML=msg;
	document.getElementById("td_"+elem+"_id").className="item_not_acept";
		}else
		{
			document.getElementById(image_id).src="/images/bg/checkbullet.gif";
			document.getElementById("l_"+image_id).innerHTML="";
			document.getElementById("td_"+elem+"_id").className="";
		}
	}
	function show_m_elem(elem)
	{
		document.getElementById(elem).className="tr_visible";
	}
	function hide_m_elem(elem)
	{
		document.getElementById(elem).className="tr_hidden";
	}
	function check_pass(){
		
		check_require_('pass2','img_s_pass2',"تکرار کلمه عبور را وارد نمایید");
		if(document.getElementById('pass2').value!=document.getElementById('pass').value)
		{
document.getElementById('img_s_pass2').src="/images/bg/icon4.gif";		
	document.getElementById("l_img_s_pass2").innerHTML="کلمات عبور یکی نمی باشند";
	document.getElementById("td_pass2_id").className="item_not_acept";
		}else if(document.getElementById('pass2').value!="")
		{
			document.getElementById('img_s_pass2').className="hidden_item";		
	document.getElementById("l_img_s_pass2").innerHTML="";
	document.getElementById("td_pass2_id").className="";
		}
		
	}
	function show_my_msg(msg)
	{
		document.getElementById("smg_show").innerHTML ="*"+msg;
	}
	function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}
