function isArray(obj){return(typeof(obj.length)=="undefined")?false:true;}

function openWindow(url,name,w,h,pos,props){
 var _wnd,left=0,top=0
  if(name==null)name='wnd'
 if(!pos||pos=='center'){left=screen.width?(screen.width-w)/2:100; top=screen.height?(screen.height-h)/2:100}
 props='width='+w+',height='+h+',top='+top+',left='+left+(props==''?'':','+props)
 _wnd=window.open(url,name,props)
  if(pos=='maximize')_wnd.resizeTo(screen.availWidth,screen.availHeight)
  if(name=='wnd'){wnd=_wnd}else{return _wnd}
}

function cNavBtn(curPage,pageCount,mOutImage,mOverImage,mDownImage,btnClass,width,frm,page){
	this.curPage = curPage
	this.pageCount = pageCount
	this.mOutImage = mOutImage
	this.mOverImage = mOverImage
	this.mDownImage = mDownImage
	this.btnClass = btnClass
	this.width = width
	this.frm = frm
	this.page = page

	this.firstBtn=function(str){
		document.writeln('<input type=submit value="'+ (str==null?"    |<    ":str) + '" name="btnFirst" width='+ this.width + (this.btnClass==null?"":" class="+this.btnClass) + (this.curPage==1?" disabled":"")  + ' onclick="document.'+this.frm+'.'+this.page+'.value=1" onMouseOut="chgbg(this,\''+this.mOutImage+'\')" onMouseOver="chgbg(this,\''+this.mOverImage+'\')" onMouseDown="chgbg(this,\''+this.mDownImage+'\')">')
	}
						
	this.prevBtn=function(str){
		document.writeln('<input type=submit value="'+ (str==null?"    <    ":str) + '" name="btnPrev" width='+ this.width + (this.btnClass==null?"":" class="+this.btnClass) + (this.curPage==1?" disabled":"")  + ' onclick="document.'+this.frm+'.'+this.page+'.value=eval(document.'+this.frm+'.'+this.page+'.value)-1<=1?1:eval(document.'+this.frm+'.'+this.page+'.value)-1" onMouseOut="chgbg(this,\''+this.mOutImage+'\')" onMouseOver="chgbg(this,\''+this.mOverImage+'\')" onMouseDown="chgbg(this,\''+this.mDownImage+'\')">')
	}
				
	this.nextBtn=function(str){
		document.writeln('<input type=submit value="'+ (str==null?"    >    ":str) + '" name="btnNext" width='+ this.width + (this.btnClass==null?"":" class="+this.btnClass) + (this.curPage>=this.pageCount?" disabled":"")  + ' onclick="document.'+this.frm+'.'+this.page+'.value=eval(document.'+this.frm+'.'+this.page+'.value)+1>='+this.pageCount+'?'+this.pageCount+':eval(document.'+this.frm+'.'+this.page+'.value)+1" onMouseOut="chgbg(this,\''+this.mOutImage+'\')" onMouseOver="chgbg(this,\''+this.mOverImage+'\')" onMouseDown="chgbg(this,\''+this.mDownImage+'\')">')
	}
			
	this.lastBtn=function(str){
		document.writeln('<input type=submit value="'+ (str==null?"    >|    ":str) + '" name="btnLast" width='+ this.width + (this.btnClass==null?"":" class="+this.btnClass) + (this.curPage>=this.pageCount?" disabled":"")  + ' onclick="document.'+this.frm+'.'+this.page+'.value=' + this.pageCount +'" onMouseOut="chgbg(this,\''+this.mOutImage+'\')" onMouseOver="chgbg(this,\''+this.mOverImage+'\')" onMouseDown="chgbg(this,\''+this.mDownImage+'\')">')
		// alert(str)
	}
						
}

function chgbg(obj,bg){
	obj.style.background='url("'+bg+'")';
}

function showVal(ar,val,emptyStr){
	var tmpStr = ""
	if (emptyStr) tmpStr = emptyStr
	for(var i=0;i<ar.length;i+=2)
		if (val==ar[i])	{tmpStr = ar[i+1]}
	if (tmpStr == "")
	{
		tmpStr = ""
	}
	document.write(tmpStr)
}

function thumbnail(file,width){
	arFile = file.split(".")
	file1 = arFile[0] + "a." + arFile[1]	
	var today=new Date()
	var time=today.getSeconds()
	if (width!="")
	{
		document.write("<a href=\"javascript:poppic('"+file+"')\"><img src="+file1+"?"+time.valueOf()+" border=1 width="+width+"></a>")
	}
	else
	{
		document.write("<a href=\"javascript:poppic('"+file+"')\"><img src="+file1+"?"+time.valueOf()+" border=1></a>")
	}
	
}
	
function poppic(file){
	//600x450
	openWindow(file,'wndRP',600,450,'center','scrollbars=auto')
}
	
function lstBox2(lstName,ar,val,style){
	document.open()
	document.writeln("<select name=" + lstName + (style==""?"":" " +style) + " onChange='this.form.submit()'>")
	document.writeln("<option value=''>--  All   --</option>")
	for(var i=0;i<ar.length;i+=2)
		document.writeln("<option value='"+ar[i] + "'" + (ar[i]==val?" selected":"") + ">" + ar[i+1] + "</option>")
		document.writeln("</select>")
		document.close()
					
}

function lstBox(lstName,ar,val,style){
	document.open()
	document.writeln("<select name=" + lstName + (style==""?"":" " +style) + ">")
	document.writeln("<option value=''>Please select</option>")
	for(var i=0;i<ar.length;i+=2)
		document.writeln("<option value='"+ar[i] + "'" + (ar[i]==val?" selected":"") + ">" + ar[i+1] + "</option>")
		document.writeln("</select>")
		document.close()
					
}

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 wrFlash(src,w,h){
document.write ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
document.write ('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
document.write ('WIDTH="'+w+'" HEIGHT="'+h+'" id="'+src+'" ALIGN=""> ');
document.write ('<PARAM NAME=movie VALUE="'+src+'.swf"> ');
document.write (' <PARAM NAME=movie VALUE="menu.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=wmode VALUE=transparent> <PARAM NAME=bgcolor VALUE=#FFFFFF> ');
document.write ('<EMBED src="'+src+'.swf" quality=high bgcolor=#FFFFFF ');
document.write ('WIDTH="'+w+'" HEIGHT="'+h+'" NAME="'+src+'" ALIGN="" ');
document.write ('TYPE="application/x-shockwave-flash" ');
document.write ('PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
}

