// make menu

function menu(id)

{



for(var i=1;i<=6;i++)

  if(i!=id)

	{

	$('div#sub_menu'+i).hide();

	$('li#item'+i).attr("class","");

	}





$('li#item'+id).attr("class","current");

$('div#sub_menu'+id).show();

}





// function that style form elements

function style_form()

{

$(".form  input[type=text][class!=colorwell]").attr("class", "textBox");

$(".form  textarea").attr("class", "textArea");

$(".form  input[type=password]").attr("class", "textBox");

$(".form  label").attr("class", "label");

$(".form  input[type=file]").attr("class", "file");

$(".form  input[type=submit]").attr("class", "button");

$(".form  input[type=button]").attr("class", "button");

$("table.infoTable  tr:even").attr("class", "even");

$("table.infoTable  tr:odd").attr("class", "odd");

$("table.dataGrid  tr:even").attr("class", "even");

$("table.dataGrid  tr:odd").attr("class", "odd");



}



function pagination(type,obj,url)

{

alert('reached');

$("div#loading").show();

$("#"+type).hide();

$.post(url,{},function(data){

													$(".current").attr("class","");

													$("#"+type).html(data);

													$("#"+type).show();

													$(obj).attr("class","current");

													$("div#loading").hide();

													})}



function show_details(type,product_id)

{$("#"+type+product_id).toggle();}



function collapse(value,type)

{



$("div[id^="+value+"]").each(function(){

					                   if(type==0)

									   $(this).hide();				   

									   else

									   $(this).show();				   

									   

									   })	}





function send_confirmation_code(url)

{

$("img#loading").show();

var mobile_no=$("#mobile").val();

$.post(url,{mobile:mobile_no}, function(data){

							   if(data=="")

							    $("#code_activation_result").show();

								else

							    alert(data);

								 

								 $("img#loading").hide();

							   

							   

							  });	}

 

function get_message(inbox,url,mid,type)

{

if(type)

window.location=url+mid;	

else

{



$("img#loading").show();

$.post(url,{id:mid,type:inbox}, function(data){

							    $("#message_detail").html(data); 

								$("img#loading").hide();

							  });	

	

}}





function get_sub(value)

{

$("select.sub_departments_select").each(function(i){

this.style.display=(this.id=="sub"+value)?"inline":"none";

})}







function commission_change()

{

var allam=document.getElementById("add");	

var allam2=document.getElementById("commission");



allam.disabled=(allam2.checked==true)?false:true;}





function update_profile()

{

	

  if($('#incorrect_info').is(':checked') && $('#complete_info').is(':checked') && $('#agreement').is(':checked'))

   return true;

  else

   {

	alert("يجب الموافقة على اتفاقية استخدام الموقع \n و الموافقة على اخر نقطتين فى خانة ارسال الطلب \n ");

	return false;

	}

}







function go_quick(url,type)

{

if($("#get"+type).val()=="")

{

alert("من فضلك ادخل الرقم");

return false;

}

else

window.location=url+type+"/"+$("#get"+type).val();}

				

function go_quick2(event,url,type)

{

	if(displayKeyCode(event)==13)

	go_quick(url,type);

}



function redirect(url)

{

window.location=url+"departments/search/0/0/0/0/0/20/10/0/"+$('#search').val();

return false;

}









