
function openVerMenu(mid){
	if ($('#vsubmenu_'+mid).is(':hidden')){
		//$('vsubmenu_'+mid).style.display='';
		$('#vsubmenu_'+mid).show();
		//$('vmenu_'+mid).style.color='#090909';
		saveOpenedMenu(mid,1);
	}else{
	//	$('vsubmenu_'+mid).style.display='none';
		$('#vsubmenu_'+mid).hide();
		//$('vmenu_'+mid).style.color='#090909';
		saveOpenedMenu(mid,0);
	}
}
/*
function openVerMenu(mid){
	if ($('vsubmenu_'+mid).style.display=='none'){
		$('vsubmenu_'+mid).style.display='';
		//$('vmenu_'+mid).style.color='#090909';
		saveOpenedMenu(mid,1);
	}else{
		$('vsubmenu_'+mid).style.display='none';
		//$('vmenu_'+mid).style.color='#090909';
		saveOpenedMenu(mid,0);
	}
}
function saveOpenedMenu(mid,stat){
	var url = saveMenuScript+'?mid='+mid+'&stat='+stat+'';
	new Ajax.Request(url, {
	  method: 'get',
	  onSuccess: function(transport) {
	    void(0);
	  }
	});
}*/
function saveOpenedMenu(mid,stat){
	 $.ajax({
	   type: "get",
	   url: saveMenuScript,
	   data: "mid="+mid+"&stat="+stat,
	   success: function(msg){
		 void(0);
	   }
	 });
}
window.onload=function() {
	$(".page_img a").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false
	});
}
function trimAll( strValue ) {
/************************************************
DESCRIPTION: Removes leading and trailing spaces.

PARAMETERS: Source string from which spaces will
	be removed;

RETURNS: Source string with whitespaces removed.
*************************************************/
 var objRegExp = /^(\s*)$/;

	//check for all spaces
	if(objRegExp.test(strValue)) {
		 strValue = strValue.replace(objRegExp, '');
		 if( strValue.length == 0)
			return strValue;
	}

	 //check for leading & trailing spaces
	 objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
	 if(objRegExp.test(strValue)) {
		 //remove leading and trailing whitespace characters
		 strValue = strValue.replace(objRegExp, '$2');
	}
	return strValue;
}




function change_order(){
	if(parseInt($('#Inumber').val())>0){
		$('order1').hide();
		$('order1_error').hide();
//			if(($('Iprice1').checked==true))
//				$('priceType1').show();
//			if(($('Iprice2').checked==true)){
//				$('priceType2').show();
//				$('Iaddress2').innerHTML=$('Iaddress').value;
//			}
		$('#Inumber2').html($('Inumber').val());
		$('#ibutton').removeClass('error');
		$('#order2').show();
	}else{
		$('#order1_error').show();
		$('#ibutton').addClass('error');
	}
}
function change_order2(){
	var phonereg = /(^-?\d\d*$)/;
	var mailreg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if(
		($('#Ipaytype1:checked').val() != null
		&& $('#IFname').val() != '' 
		&& $('#IFpk').val() != '' 
		&& $('#IFaddress').val() != '' 
		&& phonereg.test(trimAll($('#IFtel').val())) == true 
		&& mailreg.test(trimAll($('#IFemail').val())) == true)
		|| 
		($('#Ipaytype2:checked').val() != null) 
		&& $('#IJname').val() != '' 
		&& $('#IJreg').val() != '' 
		&& $('#IJaddress').val() != '' 
		&& $('#IJpers').val() != '' 
		&& phonereg.test(trimAll($('#IJtel').val())) == true 
		&& mailreg.test(trimAll($('#IJemail').val())) == true
	) {
		
		$('#Forder2').submit();
		$('#order2_error').hide();
		$('#ibutton2').removeClass('error');
		
	} else {
		$('#order2_error').show();
		$('#ibutton2').addClass('error');
	}
}

