// JavaScript Document

/*****Start IE Update Code
 * Following is taken from http://activecontent.blogspot.com/
 * Microsoft's IE update in April forces users to click an ActiveX control before using it. 
 * This code will fix the problem. Function will be called in the footer body.
 */
 
function isIE6() {
  // only for Win IE 6+
  // But not in Windows 98, Me, NT 4.0, 2000
  var strBrwsr= navigator.userAgent.toLowerCase();
  if (strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0) {
    if (parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6) {
      return false;
    }
    if (strBrwsr.indexOf("win98") > -1 ||
       strBrwsr.indexOf("win 9x 4.90") > -1 ||
       strBrwsr.indexOf("winnt4.0") > -1 ||
       strBrwsr.indexOf("windows nt 5.0") > -1)
    {
      return false;
    }
    return true;
  } else {
    return false;
  }
}

function isIE7() {
	if(document.all && !window.opera && window.XMLHttpRequest) {
		return true;
	} 
	else {
		return false;
	}
	
}
 
function ieupdate(){
 //var strBrowser = navigator.userAgent.toLowerCase();
 
 if( isIE6() || isIE7() ){
  var theObjects = document.getElementsByTagName('object');
  var theObjectsLen = theObjects.length;
  for (var i = 0; i < theObjectsLen; i++) {
   if(theObjects[i].outerHTML){
    if(theObjects[i].data){
     theObjects[i].removeAttribute('data');
    }
    var theParams = theObjects[i].getElementsByTagName("param");
    var theParamsLength = theParams.length;
    for (var j = 0; j < theParamsLength; j++) {
      if(theParams[j].name.toLowerCase() == 'flashvars'){
        var theFlashVars = theParams[j].value;
      }
    }
    var theOuterHTML = theObjects[i].outerHTML;
    var re = /<param name="FlashVars" value="">/ig;
    theOuterHTML = theOuterHTML.replace(re, "<param name='FlashVars' value='" + theFlashVars + "'>");
    theObjects[i].outerHTML = theOuterHTML;
   }
  }
 }
}

window.onunload = function() {
 if( isIE6() || isIE7() ) {
 	if (document.getElementsByTagName) {
  		var objs = document.getElementsByTagName("object");
  		for (i=0; i<objs.length; i++) {
 	  		objs[i].outerHTML = "";
  		}
	}
 }
}

/****End IE Update Code*******/