//--------------------- Last Modified --> 2006.11.10 ---------------------//
//------------------------------------------------------------------------------------//


//------------------- OPEN NEW WINDOW -------------------//
var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}
function Maximize()
{
window.innerWidth = screen.width;
window.innerHeight = screen.height;
window.screenX = 0;
window.screenY = 0;
alwaysLowered = false;
}
function popUpWin(url, type, strWidth, strHeight){
	closeWin();
	if (type == "fullScreen"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 160;
	}
	var tools="";
	if (type == "standard" || type == "fullScreen") tools = "resizable=no,toolbar=no,location=no,scroll=yes,scrollbars=yes,menubar=no,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "console") tools = "resizable=no,toolbar=no,location=no,directories=no,status=no,scroll=no,scrollbars=no,menubar=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}

function popUpSWF(url, type, Width, Height, arg1, arg2, arg3){
	closeWin();
	tools = "resizable=no,toolbar=no,location=no,directories=no,status=no,scroll=no,scrollbars=no,menubar=no,width="+Width+",height="+Height+",left=0,top=0";
	if(type == "mp"){
		newWindow = window.open(url+"?bandwidth="+arg1+"&video="+arg2+"&lan="+arg3, 'newWin', tools);
	}
	if(type == "mc"){
		newWindow = window.open(url+"?category="+arg1+"&videoNum="+arg2, 'newWin', tools);
	}
	if(type == "bna"){
		newWindow = window.open(url+"?procedure="+arg1+"&caseNum="+arg2, 'newWin', tools);
	}
	newWindow.focus();
}


//------------------- for clearing and replacing text in form input fields and textareas -------------------//
function clearText(thefield) {
  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
} 
function replaceText(thefield) {
  if (thefield.value=="") { thefield.value = thefield.defaultValue }
}


//---------------------ActiveX--EMBED-------------------//
function printActiveX(source, width, height, id) {
	document.write('<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" width="'+width+'" height="'+height+'" id="'+id+'" />');
	document.write('<param name="FileName" value="'+source+'" />');
	document.write('<param name="Autostart" value="True" />');
	document.write('<param name="ShowControls" value="True" />');
	document.write('<param name="ShowStatusBar" value="False" />');
	document.write('<param name="ShowDisplay" value="False"/>');
	document.write('<param name="AutoRewind" value="True" />');
	document.write('<embed src="'+source+'" width="'+width+'" height="'+height+'" />');
	document.write('</object>');
}


//------------------- Son-Of-Sucker-Fish IE Hack -------------------//
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	// for each list item in the menu...
	for (var i=0; i < sfEls.length; i++) {
		// Is this IE7?  If so, use onmouseleave to fix the fact that onmouseout won't fire
		is_IE7 = navigator.appVersion.indexOf("MSIE 7.0") != -1;

		sfEls[i].onmouseover = function() {
			this.className+=" sfHover";
			// is this a top-level menu item?
			var child_ul = this.getElementsByTagName('ul')[0];
			if (child_ul && is_IE7){
				// fix for IE7
				child_ul.style.position = 'static';
			}
		}

		sfEls[i].onmouseleave = function() {
			// is this a top-level menu item?
			var child_ul = this.getElementsByTagName('ul')[0];
			if (child_ul && is_IE7){
				// fix for IE7
				child_ul.style.position = 'absolute';
				child_ul.style.left = '-9000px';
			}
		}

		sfEls[i].onmouseout = function() {
			this.className=this.className.replace(new RegExp(" sfHover\\b"), "");
		}

	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


//------------------- Form Validation -------------------//
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 YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
  var a=arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte;
  for (i=1; i<a.length;i=i+4){
    if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
    o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
    o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
    v=o.value;t=a[i+2];dv = o.defaultValue;
    if (o.type=='text'||o.type=='password'||o.type=='hidden'){
      if ((r&&v.length==0)||v==dv){err=true}
      if (v.length>0)
      if (t==1){ //fromto
        ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
      } else if (t==2){
        rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
      } else if (t==3){ // date
        ma=a[i+1].split("#");at=v.match(ma[0]);
        if(at){
          cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
          dte=new Date(cy,cm,cd);
          if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
        }else{err=true}
      } else if (t==4){ // time
        ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
      } else if (t==5){ // check this 2
            if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!o1.checked){err=true}
      } else if (t==6){ // the same
            if(v!=MM_findObj(a[i+1]).value){err=true}
      }
    } else
    if (!o.type&&o.length>0&&o[0].type=='radio'){
          at = a[i].match(/(.*)\[(\d+)\].*/i);
          o2=(o.length>1)?o[at[2]]:o;
      if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
      if (t==2){
        oo=false;
        for(j=0;j<o.length;j++){oo=oo||o[j].checked}
        if(!oo){s+='* '+a[i+3]+'\n'}
      }
    } else if (o.type=='checkbox'){
      if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
    } else if (o.type=='select-one'||o.type=='select-multiple'){
      if(t==1&&o.selectedIndex/1==0){err=true}
    }else if (o.type=='textarea'){
      if(v.length<a[i+1]){err=true}
    }
    if (err){s+=a[i+3]+'\n'; err=false}
  }
  if (s!=''){alert('Please complete the following required fields:\t\t\t\t\t\n\n'+s)}
  document.MM_returnValue = (s=='');
}


<!--
var popwin = null;
function PopupImage(link,wtitle,w,h) {
if (popwin) popwin.close();
popwin = window.open("",'popwindow','toolbar=no,location=no,directories=no,status=no,menubar=no,width='+w+',height='+h+',scrollbars=yes,resizable=no,screenX=50,screenY=50,left=50,top=50');
popwin.document.write('<HTML><HEAD><TITLE>' + wtitle + '</TITLE><body topmargin="2" leftmargin="2" marginwidth="2" marginheight="2" bgcolor="#FFFFFF" onLoad="self.focus()">');
if (wtitle) popwin.document.write('<CENTER><FONT SIZE="3" FACE="arial"><B>' + wtitle + '</B></FONT></CENTER><BR>');
popwin.document.write('<CENTER><IMG SRC="' + link + '" BORDER="0" ALT="' + wtitle + '"></CENTER>');
popwin.document.write('<BR><CENTER><A HREF="javascript: self.close();"><FONT SIZE="2" FACE="arial">Close Window</FONT></A></CENTER>');
popwin.document.write('</BODY></HTML>');
popwin.document.close() ;
//popwin.location.href = link;
//popwin.focus();
}
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_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 MIVA_swapImage( main_id, sub_div_id, trigger, showHide, thumb, prod_code) { //v3.0
	var main = document.getElementById( main_id );
	var prod = prod_code;

//if function was called on a attribute selection then grab the correct image path to the thumbnail	
	
	if (thumb =='dropdown'){
		 var temp_src = 'graphics/00000001/' + prod + '-sub' + sub_div_id.selectedIndex + '-item0-tn200.jpg';
	 }else{
		 var temp_src = trigger.src;
	 }
// If clicking on one of the main thumbail images or attribute dropdown then replace the -tn200 or -thumb with nothing.
// This will give main_src the path to the fillsize image.
	
	if (thumb == 'yes' || thumb =='dropdown'){
		main.src = temp_src.replace( '-tn200','' );
	}else{
		main.src = temp_src.replace( '-thumb','' );
	}
	
 // if dropdown menu swap out light box href (zoom image) with zoom link. All others do the same function a different way
 
	if (thumb =='dropdown'){
	
	var change_link = document.getElementById('lightboxlink');
	change_link.href  = 'graphics/00000001/' + prod + '-sub' + sub_div_id.selectedIndex + '-item0-zoom.jpg';
	
	}else{
	var temp_href = trigger.parentNode.href;
	main.parentNode.href = temp_href.replace( '.jpg', '-zoom.jpg' );
	
	}

// This loop itterates through all the divs on the page which are child divs of view-prod. If any of the child divs 
// have and ID then set their display to none.

	var view_divs = document.getElementById( 'view-prod' ).getElementsByTagName( 'div' )
	for( var i=0; i<view_divs.length; i++ )
	{
		if( view_divs[ i ].id )view_divs[ i ].style.display = 'none';
	}

//Display the correct div for the 6 right side images. Dropdown requires a different method.	 
	 
	 if (thumb =='dropdown'){
		var subID = 'sub';
	    subID = subID + sub_div_id.selectedIndex;
		document.getElementById( subID ).style.display = 'block';
	 }else{
		 document.getElementById( sub_div_id ).style.display = 'block';
	 }
	
	// If user clicks on any of the main color selections, modify the dropdown menu to reflect this.
	
	if (thumb =='yes'){
	var color_dropdown = document.getElementById('color_dropdown');
	var selected =  sub_div_id.replace( 'sub','' );
	
	color_dropdown.selectedIndex = selected;
	}
	
	// show / hide function used show hide png overlay for product name.
	
	if( showHide == 'hide' )
		document.getElementById( 'prod-overlay' ).style.top = -2000 + 'px';
	else if( showHide == 'show' )
		document.getElementById( 'prod-overlay' ).style.top = 0 + 'px';


}

function printSelectedProduct(){	
    var color_dropdown = document.getElementById('color_dropdown');
	var sub_input = document.getElementById('sub_id');
	
	sub_input.value = 'sub' + color_dropdown.selectedIndex;
	
}




//-->
