// function to pass flash date picker data to html form field
function popUlate(uTarget,pData) {
	uTarget.value = pData;
}

function copyMe(obj) {
	var holdtext = document.all['holdtext'];
	holdtext.innerText = obj.innerText;
	Copied = holdtext.createTextRange();
	Copied.execCommand("Copy");
	alert("The code has been copied to your clipboard...");
}





// misc functions
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_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_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// scroll content functions
var ns = document.layers;
var loaded = false;

if (document.images) {
var uparrowa = new Image();
uparrowa.src = "/media/images/img_lower_arrow.jpg";
var uparrown = new Image();
uparrown.src = "/media/images/img_lower_arrow_f2.jpg";
var downarrowa = new Image();
downarrowa.src = "/media/images/img_upper_arrow.jpg";
var downarrown = new Image();
downarrown.src = "/media/images/img_upper_arrow_f2.jpg";}

function getObj(name) {
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	this.style = this.obj;
  }
}

function getObjNN4(obj,name) {
	var x = obj.layers;
	var thereturn;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	thereturn = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) thereturn = tmp;
	}
	return thereturn;
}

var clipTop = 0;
var clipWidth = 543;
var clipBottom = 480;
var topper = 0;
var lyrheight = 480;
var time,amount,theTime,theHeight,DHTML;

function prepLyr(){
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('clipTrap');
	if (document.layers)
	{
		x.style.clip.bottom = clipBottom;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
	}
}

function scrollInit(){	
	prepLyr();
	if (ns){ 
		scroller1 = new  makeScrollObj('scroller1','mainContent','outerClip.document.clipTrap',543);}
	else{
    	scroller1 = new  makeScrollObj('scroller1','mainContent','clipTrap',543);}
	loaded = true;
}
function scrollup(imgName) {
	if (document.images && loaded){
		if (ns){
			//var x = new getObj('up1');
			//alert("crap3 " +document.OuterDiv.document.images[imgName]);
			 // document.images[imgName].src = eval(imgName + "n.src");
			 }
		else{document.images[imgName].src = eval(imgName + "n.src");}
	}
	scroll(scroller1,5);
}
function scrolldown(imgName) {
	if (document.images && loaded)
	if (ns){}
    else {document.images[imgName].src = eval(imgName + "n.src");}
	scroll(scroller1,-5);
}
function noscrollup(imgName){
	if (document.images && loaded)
	if (ns){}
	else {document.images[imgName].src = eval(imgName + "a.src");}
	noScroll(scroller1);
}
function noscrolldown(imgName){
	if (document.images && loaded)
	if (ns){}
	else{document.images[imgName].src = eval(imgName + "a.src");}
	noScroll(scroller1);
}
function makeScrollObj(objId,layerId,parent,height){
	if (document.getElementById) {
		this.style = document.getElementById(layerId).style; 
		this.style.top=0;
		this.unit = 'px';
		this.scrollHeight = document.getElementById(layerId).offsetHeight;
	} else if (document.all) {
		this.style = eval('document.all.'+layerId+'.style');
		this.style.top=0;
		this.unit = 'px';	
		this.scrollHeight = eval('document.all.'+layerId+'.offsetHeight');
	} else if (document.layers) {
	    parent=(parent)? 'document.'+parent+'.':'';
	    this.style = eval(parent+'document.'+layerId);
		this.unit = '';
		this.scrollHeight = this.style.document.height;	
	}
    this.id   = objId;
	this.contHeight = height;
    this.top  = getTop;
	this.setTop  = setTop;
}
function returnToTop(obj,y) {obj.style.top=y+obj.unit;}

function getTop() {return parseInt(this.style.top);}
function setTop(y) {this.style.top=y+this.unit;}

// Scroll Variables
var scrollTimer = new Array();	// timeouts for each scrolling object
var fps=50, deltaT = 1000/fps;	// fps = frames per second; deltaT in millisecs
//var contHeight = 175;			// height of scroll clipping area

function scroll(obj,vy){
    if (scrollTimer[obj.id]) clearTimeout(scrollTimer[obj.id]);
    py=obj.top();
    py+=vy; yMin=0; yMax=obj.contHeight-obj.scrollHeight;
	if(py<yMax){py=yMax;vy=0;} if(py>yMin){py=yMin;vy=0;}
	obj.setTop(py);
    if (vy!=0) scrollTimer[obj.id]=setTimeout("scroll("+obj.id+","+vy+")",deltaT);
}
function noScroll(obj){
    if (scrollTimer[obj.id]) clearTimeout(scrollTimer[obj.id]);
}


// pic window functions
function PicWin(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
	var head = "";
	
	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("picwin.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title>'+head+'<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="Click screen to close" >'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}
