// start: mouseover script and image preloader
	
function msover(img,ref){
	document.images[img].src = ref;
}

function msout(img,ref){
	document.images[img].src = ref;
}

String.prototype.trim = function(){
a = this.replace(/^\s+/, '');
return a.replace(/\s+$/, '');
};

String.prototype.reverse=function(str){
	var newStr="";
	for (i=0;i<=str.length;i++){
		newStr = str.charAt(i) + newStr;
	}
	return newStr;
}

String.prototype.replaceAll=function(haystack, needle, replacement){
	while(haystack.indexOf(needle)!=-1){
		haystack=haystack.replace(needle, " ");
	}
	return haystack;
}	

String.prototype.toProperCase = function(){
	return this.toLowerCase().replace(/^(.)|\s(.)/g, function($1) { return $1.toUpperCase(); });
};

document.getElementsByClassName = function(clsName){
	var retVal = new Array();
	var elements = document.getElementsByTagName("*");
	for(i = 0;i < elements.length;i++){
		if(elements[i].className.indexOf(" ") >= 0){
			var classes = elements[i].className.split(" ");
			for(var j = 0;j < classes.length;j++){
				if(classes[j] == clsName){
					retVal.push(elements[i]);
				}
			}
		}
		else if(elements[i].className == clsName)
			retVal.push(elements[i]);
		}
	return retVal;
};

Array.prototype.inArray = function (value,caseSensitive){
	//**this** represents the array the function is called on.  does not need to be passed because this is prototype function.
	for (i=0; i < this.length; i++) {
		if(!caseSensitive){
			if (this[i].toLowerCase() == value.toLowerCase()) {
				return true;
			}
		}
		else{
			if (this[i] == value) {
				return true;
			}
		}
	}
	return false;
};

/*Pass enforceNumeric() the text field to verify, the event, and an optional array of additional allowable unicode value entries as strings.
This function requires the Array prototype inArray() 
Common exception codes:
36="$"
45="-"
40="("
41=")"
69="E"
84="T"
88="X"
101="e"
116="t"
120="x"
Example call: <input type="text" id="myField" name="myField" onkeypress="return enforceNumeric(this,event,new Array('120','36','88','45'));"/>
*/
function enforceNumeric(/*text field*/ field, /*event*/ e, /*optional array of allowable uncode keycodes*/ allowed){
	char=e.charCode ? e.charCode : e.keyCode;
	if (char!=8 && char!=46){ //8=backspace 46=period
		if (char<48||char>57){
			if(allowed && allowed.length>0){
				for(i=0; i<allowed.length; i++){
					if(allowed.inArray(char)){
						return true;
					}
					else{
						return false;	
					}
				}
			}
			else{
				return false;	
			}
		}
		else{
			return true;
		}
	}
	else if(char==46){
		if(field.value.indexOf(".")==-1){
			return true;
		}
		else{
			return false;	
		}
	}
}

function playVideo(){
	document.write("<object id=\"MediaPlayer\" width=320 height=240 classid=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" standby=\"Loading Windows Media Player components…\" type=\"application/x-oleobject\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112\">");
	document.write("<param name=\"filename\" value=\"http://www.re-glo.com/inc/movs/See_Me_Reflective_Products.wmv\">");
	document.write("<param name=\"Showcontrols\" value=\"True\">");
	document.write("<param name=\"autoStart\" value=\"false\">");
	document.write("<embed type=\"application/x-mplayer2\" src=\"http://www.re-glo.com/inc/movs/See_Me_Reflective_Products.wmv\" name=\"MediaPlayer\" width=320 height=240 ShowContorls=\"1\" autostart=\"0\"></embed>");
	document.write("</object>");
}

function playTVVideo(){
	document.write("<object id=\"MediaPlayer\" width=320 height=240 classid=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" standby=\"Loading Windows Media Player components…\" type=\"application/x-oleobject\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112\">");
	document.write("<param name=\"filename\" value=\"http://www.re-glo.com/inc/movs/Find a Light 60PI rev 10-08.wmv\">");
	document.write("<param name=\"Showcontrols\" value=\"True\">");
	document.write("<param name=\"autoStart\" value=\"false\">");
	document.write("<param name=\"loop\" value=\"1\">");
	document.write("<embed type=\"application/x-mplayer2\" src=\"http://www.re-glo.com/inc/movs/Find a Light 60PI rev 10-08.wmv\" name=\"MediaPlayer\" width=320 height=240 ShowContorls=\"1\" autostart=\"0\" loop=\"1\"></embed>");
	document.write("</object>");
}

function playTVVideo2(){
	document.write("<object id=\"MediaPlayer\" width=320 height=240 classid=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" standby=\"Loading Windows Media Player components…\" type=\"application/x-oleobject\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112\">");
	document.write("<param name=\"filename\" value=\"http://www.re-glo.com/inc/movs/Find-a-Light-Video-only.wmv\">");
	document.write("<param name=\"Showcontrols\" value=\"True\">");
	document.write("<param name=\"autoStart\" value=\"true\">");
	document.write("<param name=\"loop\" value=\"1\">");
	document.write("<embed type=\"application/x-mplayer2\" src=\"http://www.re-glo.com/inc/movs/Find-a-Light-Video-only.wmv\" name=\"MediaPlayer\" width=320 height=240 ShowContorls=\"1\" autostart=\"1\" loop=\"1\"></embed>");
	document.write("</object>");
}

function playSeeMeVideo(){
	document.write("<object id=\"MediaPlayer\" width=320 height=240 classid=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" standby=\"Loading Windows Media Player components…\" type=\"application/x-oleobject\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112\">");
	document.write("<param name=\"filename\" value=\"http://www.re-glo.com/inc/movs/SeeMe-nosound.wmv\">");
	document.write("<param name=\"Showcontrols\" value=\"True\">");
	document.write("<param name=\"autoStart\" value=\"false\">");
	document.write("<embed type=\"application/x-mplayer2\" src=\"http://www.re-glo.com/inc/movs/SeeMe-nosound.wmv\" name=\"MediaPlayer\" width=320 height=240 ShowContorls=\"1\" autostart=\"0\"></embed>");
	document.write("</object>");
}

function playFindALightVideo(){
	document.write("<object id=\"MediaPlayer\" width=320 height=240 classid=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" standby=\"Loading Windows Media Player components…\" type=\"application/x-oleobject\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112\">");
	document.write("<param name=\"filename\" value=\"http://www.re-glo.com/inc/movs/findalight-nosound.wmv\">");
	document.write("<param name=\"Showcontrols\" value=\"True\">");
	document.write("<param name=\"autoStart\" value=\"True\">");
	document.write("<embed type=\"application/x-mplayer2\" src=\"http://www.re-glo.com/inc/movs/findalight-nosound.wmv\" name=\"MediaPlayer\" width=320 height=240 ShowContorls=\"1\" autostart=\"0\"></embed>");
	document.write("</object>");
}