 function Imagepop(url, title, width, height)
  {
	 height+=60;
	 var winstr = "<html>";
	 winstr+='<script language = "javascript"> var OnTop = true;';
	 winstr+='function ChangeOnTop(){if (OnTop == true) OnTop = false;else if (OnTop == false){OnTop = true;self.focus(); }}';
	 winstr+='function FocusMe(){if (OnTop == true) setTimeout("self.focus()",250);}';
	 winstr+='window.resizeTo('+width+','+height+');';
	 winstr+='</script>';
	 winstr+='<body leftmargin=0 topmargin=0 onBlur = "FocusMe()" >';
     winstr+='<img src="'+url+'" onclick="window.close();window.focus();" style="cursor:hand;"></body></html>';
     popup = window.open("", title,'width=' + width + 'px,' + 'height=' + height+'px');
	 popup.focus();
     popup.document.open();
     popup.document.write(winstr);
     popup.document.close();
  }

  function pop(url, title, width, height)
  {
     popup = window.open(url, "",'width=' + width + ',' + 'height=' + height);
     popup.document.open();
  }
 
 function messageWindow(title, msg)
{
  var width="300", height="150";
  var left = (screen.width/2) - width/2;
  var top = (screen.height/2) - height/2;
  var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
  var msgWindow = window.open("","msgWindow", styleStr);
  var head = '<head><title>'+title+'</title></head>';
  var body = '<center>'+msg+'<br><p><form><input type="button" value="   Done   " onClick="self.close()"></form>';
  msgWindow.document.write(head + body);
}

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_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_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_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function onChange(object) {
    var Current = object.selectName.selectedIndex;
    object.currentText.value = object.selectName.options[Current].text;
    object.currentValue.value = object.selectName.options[Current].value;
}

function deleteOption(object) {
    var Current = object.selectName.selectedIndex;
    object.selectName.options[Current] = null;
}

function addOption(object) {
    var defaultSelected = true;
    var selected = true;
    var optionName = new Option(object.currentText.value, object.currentValue.value, defaultSelected, selected)
    var length = object.selectName.length;
    object.selectName.options[length] = optionName;
}

function replaceOption(object) {
    var Current = object.selectName.selectedIndex;
    object.selectName.options[Current].text = object.currentText.value;
    object.selectName.options[Current].value = object.currentText.value;
}

function AddCheckbox(objname,input)
 {
    var str;
  	//alert(obj.HTMLInputElement.value);
    var cnt = document.getElementById(objname).rows.length;
    var tbl=document.getElementById(objname);
	var tinput=document.getElementById(input);
	var cname=tinput.value;
	var fieldname=objname+"["+cnt+"]";
	//alert(fieldname);
	if(cname!=""){
		str ="<tr><td width=100%><input name='"+fieldname+"' type='checkbox' value='"+cname+"'>"+cname+"</td></tr>"; 
		tinput.value="";
		var td=document.createElement('td');
		td.innerHTML=str;
		var tr=document.createElement('tr');
		tr.appendChild(td);
		tbl.firstChild.appendChild(tr);
	}
 }
function JumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function selectoption(fname){
	obj=document.isearch;
	str='';
	 for(i=0;i<obj.length;i++){
			str+='&'+obj[i].name+'='+obj[i].value;
	 }
	 url='getoption.php?fldname='+fname+str;
	 window.open(url, "",'width=400,height=300');
     //popup.document.open();
	 return false;
}

function selectEmbededOption(fname,path){
	
	obj=document.isearch;
	str='';
	 for(i=0;i<obj.length;i++){
			str+='&'+obj[i].name+'='+obj[i].value;
	 }
	 url=path+'getoption.php?fldname='+fname+str;
	 window.open(url, "",'width=400,height=300');
     //popup.document.open();
	 return false;
}


//flash player control 
var MM_contentVersion = 7;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
                var words = navigator.plugins["Shockwave Flash"].description.split(" ");
                for (var i = 0; i < words.length; ++i)
                {
                if (isNaN(parseInt(words[i])))
                continue;
                var MM_PluginVersion = words[i]; 
                }
        var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
        document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
        document.write('on error resume next \n');
        document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
        document.write('</SCR' + 'IPT\> \n');
}


function CreateFlashCode(swfSrc, w, h, bg, wmode, flashVars) {
        if ( MM_FlashCanPlay ) {
                document.write('<object width="'+ w +'" height="'+ h +'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">');
				document.write('<param name="movie" value="'+ swfSrc +'" />');
                document.write('<param name="quality" value="high" />');
                document.write('<param name="bgcolor" value="'+ bg +'" />');
                document.write('<param name="wmode" value="'+ wmode +'" />');
                document.write('<param name="FlashVars" value="'+ flashVars +'" />');
                document.write('<embed src="'+ swfSrc +'" FlashVars="'+ flashVars +'"  wmode="'+ wmode +'" quality="high" bgcolor="'+ bg +'"  width="'+ w +'" height="'+ h +'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" />');
                document.write('</object>');
        }
}

function email_check(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1)  return false;
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) return false;
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) return false;
		if (str.indexOf(at,(lat+1))!=-1) return false;
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) return false;
		 if (str.indexOf(dot,(lat+2))==-1) return false;
		 if (str.indexOf(" ")!=-1) return false;
 		 return true					
}

function email_verify(formname,email,info){
	for(var i=0;i<info.length;i++){
		var temp=info[i];
		var obj=document.getElementsByName(temp[0]);
		var data=obj[0].value;
		if(data=="" || data==null){
			alert(temp[1]);
			return;
		}
		if(obj[0].name==email && !email_check(data)){
			alert(temp[1]);
			return;
		}
	}
	var fobj=document.getElementsByName(formname);
	fobj[0].submit();
}
