
function PageList(){
	df = document.forms['frm'];
	sNewStatus = "show"
	if(df.fIsAdmin.checked) sNewStatus = "hide"
	MM_showHideLayers("oPageList",'',sNewStatus);
}

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]; 
  if(d.forms) 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;
}


//MM_showHideLayers('Layer1','','show','LL','','hide')
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  
  for (i=0; i<(args.length-2); i+=3) {
    obj=MM_findObj(args[i],args[i+1])    
    if (obj!=null) { 
        v=args[i+2];
        if (obj.style) { 
            obj=obj.style; 
            v=(v=='show')?'visible':(v=='hide')?'hidden':v;
           v1 = (v=='visible')?'':'none';

            if(obj.display)  obj.display = v1;
            }
        obj.visibility=v; 
    }
    else { //alert('not find '+args[i]) 
         }
   }
}

function getMultipleListvalue(obj){
    var rz = "";
    for (var j = 0; j < obj.options.length; j++)
		if (obj.options[j].selected )
		    rz += "," + obj.options[j].value ;

	if (rz.length > 0)
	       rz = rz.substring(1,rz.length);
	return rz
 }

function getPages(){

	df = document.forms['frm'];
    sResult=""
	if(!df.fIsAdmin.checked) {
		if(df.fPa){
		  if (""+df.fPa.length !="undefined")  // when object is a array of check boxes
				sResult = getSetCheckbox(df.fPa) // return values separated by "," as string
			else
				sResult = getCheckbox(df.fPa)  // return true if check box is selected
		}
		df.fPages.value = sResult
	}
}

// Check button
function getCheckbox(obj){
  if (obj.checked)
     return obj.value;
   else
     return "";
}
// get a set of check boxes with same name, but different values
function getSetCheckbox(obj){
   var rz = "";
   for (var j = 0; j < obj.length; j++)
		if (obj[j].checked )
		    rz += "," + obj[j].value ;
   if (rz.length > 0)
	        rz = rz.substring(1,rz.length);
   return rz

}

function MM_setTextOfLayer(objName,x,newText,flEscape) { //v4.01
  if ((obj=MM_findObj(objName,x))!=null) {
    with (obj)
        if (document.layers) {document.write(unescape(newText)); document.close();}
        else innerHTML = unescape(newText);
   return true
  }                
  else{return false}
  
}


//	function newWin(strURL,winName){
		function newWin(sCode,fl){

strURL = "jobdescr.php?c="+sCode
if(fl) strURL = "jobdescr1.php?c="+sCode

//winName = "myW_"+sCode
winName = "myW"

		var LeftPosition;
		var TopPosition;
		var w;
		var h;
		w = 600;
		h = 500;
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		//window.open(strURL, winName, 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,location=1,statusbar=1,menubar=1');
		window.open(strURL, winName, 'top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,location=1,status=1,menubar=1');
	}

		function newWin1(strURL){

		var LeftPosition;
		var TopPosition;
		var w;
		var h;
		w = 400;
		h = 600;
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		//window.open(strURL, winName, 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,location=1,statusbar=1,menubar=1');
		window.open(strURL, "print1", 'top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,location=1,status=1,menubar=1'+',width='+w+',height='+h);
	}


function clearF(sFieldID,sDefTxt){
	var o  = document.getElementById(sFieldID)
	if(o) {
		if(o.value==sDefTxt)	{
				o.value=""
				o.className=o.className + " on"
		}
	}
}

function restoreF(sFieldID,sDefTxt){
	var o  = document.getElementById(sFieldID)
	if(o) {
		if(o.value=="") {
				o.value=sDefTxt
				s = o.className
				s = s.replace(" on","")
				o.className = s
		}
	}
} 