var Tout;

function show(id,num){
for(i=0;i<num;i++)
   {
   if(document.getElementById(i)){
     document.getElementById(i).style.display="none";}
   }
if(Tout!="") clearTimeout(Tout); 
  document.getElementById(id).style.display="inline";
}

function hide(id){
 if(Tout!="") clearTimeout(Tout); 
   Tout=setTimeout('document.getElementById("'+id+'").style.display="none"',300);
 }
 
function NewWindow(mypage,myname,w,h,scroll,locat,direct,stat,men,tool,res,pos) {
var win=null;
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location='+locat+',directories='+direct+',status='+stat+',menubar='+men+',toolbar='+tool+',resizable='+res+'';
win=window.open(mypage,myname,settings);
win.focus();
}

function field_check(names, fieldlabels) {
   var fields = new Array();
   var k = 0;
   for (i=0; i<names.length; i++) {
      if (document.form1.elements[names[i]].value == "") {
	     fields[k] = fieldlabels[i];
		 k++;
	  }
   }
   if (fields.length>0) {
	  var result = "The field(s) '" + fields.join(", ") + "' should be is filled !!";
      alert(result);
      return false;
   }
   return true;
}

function lang(lang) {
	var current=window.location.href;
	var new_loc;
	if(/l=/.test(current))
	 new_loc=current.replace(/l=\w*/,"l="+lang);
	else if(/\?/.test(current))
	  new_loc=current+"&l="+lang;
	else 
	  new_loc=current+"?l="+lang;  
	window.location.replace(new_loc);
}

function showPic(pic,width,height) { 
sDesrc = "width=" + width + ", height=" + height +
		", status=no, toolbar=no, menubar=no, scrollbars=no";
win=window.open("Gallery", "", sDesrc);
win.document.write("<html><style>body{padding:0px;margin:0px;}</style><body>");
win.document.write("<img src='uploads_script/picgallery/"+pic+"' width='"+width+"' height='"+height+"'><br>");
win.document.write("</body></html>");
}