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 chngNav(id, t){
    var orgSrc = document.getElementById(id).src;
    var imgName = (t == '1') ? orgSrc.replace(".gif", "_on.gif") : orgSrc.replace("_on.gif", ".gif") ;
    document.getElementById(id).src = imgName;
}

function chngImg(season, name){
	document.getElementById("bigImg").src = "/images/coll"+ season +"/collbig_"+name+".jpg";
	document.getElementById("small"+name).style.border ="1px solid #666";
  if( season == '09ss' &&  name != "38" ) document.getElementById("bigImg").usemap = "";
  if( season == '09ss' &&  name != "24" ) document.getElementById("bigImg").usemap = "";
	if( season == '09fw' &&  name != "45" ) document.getElementById("bigImg").usemap = "";
  if( season == '10fw' &&  name != "49" ) document.getElementById("bigImg").usemap = "";
  if( season == '11ss' &&  name != "49" ) document.getElementById("bigImg").usemap = "";
  if( season == '11fw' &&  name != "57" ) document.getElementById("bigImg").usemap = "";
  if( season == '12ss' &&  name != "45" ) document.getElementById("bigImg").usemap = "";


}

function chngBorder(name){
    document.getElementById("small"+name).style.border ="1px solid #ccc";
}

 
//==============================================================================
// fill out field check. does not allow space only
//==============================================================================
function isFieldCheck(theField, sFieldName){

	var sValue = theField.value.replace(/\s/g, "");
	if (sValue.length == 0) {
		alert("please enter " + sFieldName + ".");
		theField.focus();
		return true;
	}
	return false;
}

function chkPwd(){
   var frm = document.getElementById("frmPwd");
   if(isFieldCheck(frm.collPwd, "password")) return;

   frm.submit();
}
/*******************************************************
 * usages: 
  <script language="javascript" src="ieupdate.js"></script>
  <script language="javascript">
	  playObject( flashfilePath/name, width, height );
  </script>
 *******************************************************/

function playObject( sObjSrc, nWidth, nHeight, sWMode ){
  document.write("<object id='myFlash' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
  document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0' ");
  document.write("width='" + nWidth + "' height='" + nHeight + "'>");
  document.write("<param name='movie' value='" + sObjSrc + "'>");
   //document.write("<param name='flashVars' value='TIGpathToXML=samode.xml'>");
  document.write("<param name='quality' value='high'>");
  if( sWMode == "1" ) document.write("<param name='wmode' value='transparent'>");
  document.write("<embed src='" + sObjSrc + "' ");
  document.write("quality='high' ");
  document.write("pluginspage='http://www.macromedia.com/go/getflashplayer' ");
  document.write("type='application/x-shockwave-flash' ");
  document.write("width='" + nWidth + "' height='" + nHeight + "'></embed> ");
  document.write("</object>");
}

var win2;
//==============================================================================
// open new popup window where center of user's screen
// use: PopUp(sTargetURL, nWindow_width, nWindow_height, nScrollBar_YesOrNo)
//==============================================================================
function PopUp(newUrl, w, h, sb) {
      var winx = (screen.width - w) / 2 ;
      var winy = (screen.height - h) / 2;
      if( sb == '' ) sb = 0;
      features  = 'width=' + w + ',height=' + h + ',top=' + winy + ',left=' + winx;
      features += ',locationbar=no,toolbar=no';
      features += ',menubar=no,resizable=yes,status=no,scrollbars=';
      features += sb;
      if (win2 && !win2.closed)  win2.window.close();

      win2 = window.open(newUrl, 'popup', features)

      if(win2.focus) win2.focus();
}

function isNumeric(val){return(parseFloat(val,10)==(val*1));}

