/* ---------------------------- */
/* SHOW-HIDE Layer				*/
/* ---------------------------- */
/*function showlayer(layer){
	var myLayer=document.getElementById(layer);
	if(myLayer.style.display=="none" || myLayer.style.display==""){
		myLayer.style.display="block";
	} else { 
		myLayer.style.display="none";
		}
}


function hidden (arg1, arg2, arg3){
    document.getElementById(arg1).style.display='block';
    document.getElementById(arg2).style.display='none'; 
    document.getElementById(arg3).style.display='none';
    return false;
}
function show(arg1, arg2, arg3){
    document.getElementById(arg1).style.display='none';
    document.getElementById(arg2).style.display='block';
    document.getElementById(arg3).style.display='block';
    return false;
}


function showMenu(id_menu){
var my_menu = document.getElementById(id_menu);
if(my_menu.style.display=="none" || my_menu.style.display==""){
	my_menu.style.display="block";
	} else { 
	my_menu.style.display="none";
	}
}
function swapImage(idStatus){
	if(idStatus==0){
		document.arrow_profile.src ="/data/images/arrow_hover.png";
	} else if(idStatus==1){
		document.arrow_profile.src ="/data/images/arrow_select.png";
	} else if(idStatus==2){
		document.arrow_profile.src ="/data/images/arrow_menu.png";
	}
	
}



var num_f=0;
var ind=Math.round(Math.random()*10)+1;
//----------------------------------------------------------------------------
function isFieldEmpty(field,message)
{
//control if field is not empty
if(field.value.length==0)
	{
	alert(message);
	field.focus();
	return true;
	}
else return false;
}
//----------------------------------------------------------------------------
function isEmail(field,message)
{
//is field is valid email adress
var email=field.value;

if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
	return true;
else
	{
	alert(message);
	field.focus();
	return false;
	}
}
//----------------------------------------------------------------------------
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


//----------------------------------------------------------------------------
	function __show__adress__box() {
		if($('#f_type_id').val() == 3) $('#shop').show(); else $('#shop').hide();
		}

//----------------------------------------------------------------------------
	imgout=new Image(13,13);
	imgin=new Image(13,13);

/////////////////BEGIN USER EDITABLE///////////////////////////////
	imgout.src="/data/images/ico_expand.jpg";
	imgin.src="/data/images/ico_collapse.jpg";
///////////////END USER EDITABLE///////////////////////////////////

//this switches expand collapse icons
function filter(imagename,objectsrc){
	if (document.images){
		document.images[imagename].src=eval(objectsrc+".src");
	}
}

//show OR hide funtion depends on if element is shown or hidden
function shoh(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
			filter(("img"+id),'imgin');			
		} else {
			filter(("img"+id),'imgout');
			document.getElementById(id).style.display = 'none';			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = 'block';
				filter(("img"+id),'imgin');
			} else {
				filter(("img"+id),'imgout');	
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				filter(("img"+id),'imgout');
				document.all.id.style.display = 'none';
			}
		}
	}
}*/
//----------------------------------------------------------------------------
function get_object(id) {
	var object = null;
	if( document.layers ) {   
		object = document.layers[id];
	} else if( document.all ) {
		object = document.all[id];
	} else if( document.getElementById ) {
		object = document.getElementById(id);
	}
	return object;
	}

function get_models(val,pos,field) {
	$("#"+pos).innerHTML = "";
	
	$("div#loading").addClass("loading");
	$.get("/get-models.php", { p_id: val, b_id: field }, function(data){
		$("div#loading").removeClass("loading");
		 if(pos) get_object(pos).innerHTML = data;
		});
	}
	
function doReload() { location.reload(); }
