if(navigator.userAgent.indexOf('Win') == -1) {
        platform = 'MAC';
} else {
        platform = 'WIN';
}

if ((navigator.appName == "Netscape")&&(parseInt(navigator.appVersion) > 4)){
	if (platform != 'MAC'){
		//document.addEventListener("click", click, false);
	}
}
else{
	if (platform != 'MAC'){
		//document.onmousedown = click
	}
}

function click(e){

	if (navigator.appName == "Netscape"){ // Netscape
		if (parseInt(navigator.appVersion) <= 4){
			if (e.which != 1){
				alert('TAG Medical - all rights reserved\n\nThis site was designed & created by:\nwww.e-masque.com')
				return false;
			}
		}
		else{
			if (e.button != 0){
				alert('TAG Medical - all rights reserved\n\nThis site was designed & created by:\nwww.e-masque.com')
				e.preventDefault()
				e.stopPropagation();
			}
		}
	}
	else if (document.all){ //IE
		if (event.button != 1){
			alert('TAG Medical - all rights reserved\n\nThis site was designed & created by:\nwww.e-masque.com')
		}
	}

}

function stripUrl(nameRef){
	var index;
	var endstr;
	var myString;
	var name = nameRef;
	
	myString = String(document.location)
	index = myString.indexOf(name + "=");
	
	if (index == -1){
		return null;
	}
	
	index = myString.indexOf("=", index) + 1;
	
	endstr = myString.indexOf(";", index);
	
	if (endstr == -1){
		endstr = myString.length;
	}
	
	return unescape(myString.substring(index, endstr));
}

var sTemp = 0;
sTemp = stripUrl("s");

function buttonImageSwap(event,obj,imageName){
	if (event == 1){
		obj.src = ('/Images/' + imageName + '_n.jpg');
	}
	if (event == 2){
		obj.src = ('/Images/' + imageName + '_r.jpg');
	}
	if (event == 3){
		obj.src = ('/Images/' + imageName + '_d.jpg');
	}
	if (event == 4){
		obj.src = ('/Images/' + imageName + '_n.jpg');
	}
}

function showSubHTM(ref){
	top.mainAction.document.location = ref + ".htm"
}

function showSubASP(ref){
	top.mainAction.document.location = ref + ".asp"
}

var myDate = new Date();

myDay = myDate.getDate()
myYear = myDate.getYear()
myMonth = myDate.getMonth()

switch(myMonth){
	case 0: myMonth = "January";
		break;
	case 1: myMonth = "February";
		break;
	case 2: myMonth = "March";
		break;
	case 3: myMonth = "April";
		break;
	case 4: myMonth = "May";
		break;
	case 5: myMonth = "June";
		break;
	case 6: myMonth = "July";
		break;
	case 7: myMonth = "August";
		break;
	case 8: myMonth = "September";
		break;
	case 9: myMonth = "October";
		break;
	case 10: myMonth = "November";
		break;
	case 11: myMonth = "December";
		break;
}

if ((myDay == 1)||(myDay == 21)||(myDay == 31)){
	myType = "st"
}
else if ((myDay == 2)||(myDay == 22)){
	myType = "nd"
}
else if ((myDay == 3)||(myDay == 23)){
	myType = "rd"
}
else{
	myType = "th"
}

if(navigator.userAgent.indexOf('Win') == -1) {
        platform = 'MAC';
} else {
        platform = 'WIN';
}

if (navigator.appName == "Netscape"){	// Netscape
	if (parseInt(navigator.appVersion) <= 4){
		myStyles = "";
		myAll = ".";
		myBrowser = "NS";
	}
	else{
		myStyles = "').style";
		myAll = ".getElementById('";
		myBrowser = "NS6";
	}
}
else if (document.all){		//IE
	myStyles = ".style";
	myAll = ".all.";
	myBrowser = "IE";
}

function goProfile(){
	top.sideMenu.document.location = "/CoSideMenu.htm"
	top.mainAction.document.location = "/Company/Profile.htm"
}

function goServices(){
	top.sideMenu.document.location = "/SeSideMenu.htm"
	top.mainAction.document.location = "/SeMain.htm"
}

function goPrivacy(){
	top.sideMenu.document.location = "/CoSideMenu.htm"
	top.mainAction.document.location = "/Company/Privacy.htm"
}

function goGetPage(side,main){
	top.sideMenu.document.location = "/" + side + "SideMenu.htm"
	top.mainAction.document.location = main
}

function sendMail(obj){
	
	if (!checkKeyboardCharacters(obj.myName, 'Name',10)){
		return;
	}
	
	if (obj.myCompany.value != ""){
		if (!checkKeyboardCharacters(obj.myCompany, 'Company',10)){
			return;
		}
	}

	if (obj.myEmail.value != ""){
		if (!checkEmail(obj.myEmail)){
			return;
		}
	}
	else{
		alert("Email may not be blank");
		obj.myEmail.focus();
		obj.myEmail.select();
		return;
	}
	
	if (!checkStandard(obj.myPhone,'Phone Number',4)){
		return;
	}
	
	if (!checkAllCharacters(obj.Message,'Message',4)){
		return;
	}
	//var myString
	
	//myString = ("Name: " + obj.myName.value)
	//myString = (myString + "\nCompany: " + obj.myCompany.value)
	//myString = (myString + "\nE-mail: " + obj.myEmail.value)
	//myString = (myString + "\nPhone: " + obj.myPhone.value)
	//myString = (myString + "\nHeard: " + obj.howHeard.options[obj.howHeard.selectedIndex].text)
	//myString = escape(myString + "\nMessage: " + obj.Message.value)
	
	//document.location.href = "mailto:solutions@e-masque.com?Subject=" + obj.interest.options[obj.interest.selectedIndex].text + "&Body=" + myString
	
	obj.action="ThankYou.asp";
	obj.submit();

}

function stdRollover(obj,myColor){
	obj.style.color = myColor
}

function stdRollout(obj,myColor){
	obj.style.color = myColor
}

function myRollOver(obj,bgColor){
	obj.style.backgroundColor=String(bgColor)
	obj.style.color='#FFFFFF'
	obj.style.bordertop = 'solid 2px #FFFFFF'
	obj.style.borderleft = 'solid 2px #FFFFFF'	
}

function myRollOut(obj,bgColor){
	obj.style.backgroundColor=String(bgColor)
	obj.style.color='#FFFFFF'
	obj.style.bordertop = 'solid 2px #CCCCFF'
	obj.style.borderleft = 'solid 2px #9999FF'	
}

function openNewWindow(winWidth,winHeight,pageRef,myTitle,sb,tb,sc,rs,mu){

	if (navigator.appName == "Netscape"){ // Netscape
		if (parseInt(navigator.appVersion) <= 4){
			myWidth = (screen.width - winWidth) / 2;
			myHeight = (screen.height - winHeight) / 2;
			myBrowser2 = "NS";
		}
		else{
			myWidth = (screen.width - winWidth) / 2;
			myHeight = (screen.height - winHeight) / 2;
			myBrowser2 = "NS6";
		}
	}
	else if (document.all){ //IE
		myWidth = (screen.width - winWidth) / 2;
		myHeight = (screen.height - winHeight) / 2;
		myBrowser2 = "IE";
	}
	myParams = "width=" + winWidth + ",height=" + winHeight + ",status=" + sb + ",toolbar=" + tb + ",scrollbars=" + sc + ",resizable=" + rs + ",menubar=" + mu

	myWin = window.open(String(pageRef),String(myTitle),String(myParams));
	myWin.moveTo(myWidth,myHeight)
	myWin.focus()

}

function stdEngineRollover(obj){
	obj.style.color = "#FF0000"
}

function stdEngineRollout(obj){
	obj.style.color = "#0000CC"
}

function myEngineRollOver(obj){
	obj.style.backgroundColor = "#8889A5"
	obj.style.backgroundImage = 'url(/Images/Mgt/GButtBack_d.jpg)'
	obj.style.color = '#FFFFFF'
	obj.style.bordertop = 'solid 1px #272939'
	obj.style.borderleft = 'solid 1px #383A4C'	
	obj.style.borderright = 'solid 1px #E4E7FF'
	obj.style.borderbottom = 'solid 1px #E4E7FF'	
}

function myEngineRollOut(obj){
	obj.style.backgroundColor = "#FFFFFF"
	obj.style.backgroundImage = 'url(/Images/Mgt/GButtBack_n.jpg)'
	obj.style.color = '#000000'
	obj.style.bordertop = 'solid 1px #E4E7FF'
	obj.style.borderleft = 'solid 1px #E4E7FF'	
	obj.style.borderright = 'solid 1px #383A4C'
	obj.style.borderbottom = 'solid 1px #272939'	
}

function myGrEngineRollOver(obj){
	obj.style.backgroundColor = "#F48602"
	obj.style.backgroundImage = 'url(/Images/Mgt/OButtBack_d.jpg)'
	obj.style.color = '#FFFFFF'
	obj.style.bordertop = 'solid 2px #4E0004'
	obj.style.borderleft = 'solid 2px #4E0004'	
	obj.style.borderright = 'solid 1px #F6E7A1'
	obj.style.borderbottom = 'solid 1px #F6E7A1'	
}

function myGrEngineRollOut(obj){
	obj.style.backgroundColor = "#F6E7A1"
	obj.style.backgroundImage = 'url(/Images/Mgt/OButtBack_n.jpg)'
	obj.style.color = '#4E0004'
	obj.style.bordertop = 'solid 2px #F6E7A1'
	obj.style.borderleft = 'solid 2px #F6E7A1'	
	obj.style.borderright = 'solid 1px #4E0004'
	obj.style.borderbottom = 'solid 1px #4E0004'	
}

function myBlEngineRollOver(obj){
	obj.style.backgroundColor = "#8889A5"
	obj.style.backgroundImage = 'url(/Images/Mgt/GButtBack_d.jpg)'
	obj.style.color = '#FFFFFF'
	obj.style.bordertop = 'solid 1px #272939'
	obj.style.borderleft = 'solid 1px #383A4C'	
	obj.style.borderright = 'solid 1px #E4E7FF'
	obj.style.borderbottom = 'solid 1px #E4E7FF'	
}

function myBlEngineRollOut(obj){
	obj.style.backgroundColor = "#FFFFFF"
	obj.style.backgroundImage = 'url(/Images/Mgt/GButtBack_n.jpg)'
	obj.style.color = '#000000'
	obj.style.bordertop = 'solid 1px #E4E7FF'
	obj.style.borderleft = 'solid 1px #E4E7FF'	
	obj.style.borderright = 'solid 1px #383A4C'
	obj.style.borderbottom = 'solid 1px #272939'	
}

function myRedEngineRollOver(obj){
	obj.style.backgroundColor = "#990000"
	obj.style.backgroundImage = 'url(/Images/Mgt/RButtBack_d.jpg)'
	obj.style.color = '#FFFFFF'
	obj.style.bordertop = 'solid 1px #5B0505'
	obj.style.borderleft = 'solid 1px #5B0505'	
	obj.style.borderright = 'solid 1px #FFCECE'
	obj.style.borderbottom = 'solid 1px #FFCECE'	
}

function myRedEngineRollOut(obj){
	obj.style.backgroundColor = "#FF4646"
	obj.style.backgroundImage = 'url(/Images/Mgt/RButtBack_n.jpg)'
	obj.style.color = '#FFF17D'
	obj.style.bordertop = 'solid 1px #FFCECE'
	obj.style.borderleft = 'solid 1px #FFCECE'	
	obj.style.borderright = 'solid 1px #5B0505'
	obj.style.borderbottom = 'solid 1px #5B0505'	
}

function openChromeless(u,W,H,wName){

	if (navigator.appName == "Netscape"){ // Netscape
		if (parseInt(navigator.appVersion) <= 4){
			X = (screen.width - W) / 2;
			Y = (screen.height - H) / 2;
			myBrowser2 = "NS";
		}
		else{
			X = (screen.width - W) / 2;
			Y = (screen.height - H) / 2;
			myBrowser2 = "NS6";
		}
	}
	else if (document.all){ //IE
		X = (screen.width - W) / 2;
		Y = (screen.height - H) / 2;
		myBrowser2 = "IE";
	}

	n = "prod"
	cU = "/Images/Buttons/ST_Rm_n.jpg"
	cO = "/Images/Buttons/ST_Rm_r.jpg" 
	cL = ""
	mU = "/Images/Buttons/ST_Hide_n.jpg"
	mO = "/Images/Buttons/ST_Hide_r.jpg"
	xU = "/Images/Buttons/ST_Add_n.jpg" 
	xO = "/Images/Buttons/ST_Add_r.jpg" 
	rU = "/Images/Buttons/ST_Min_n.jpg"
	rO = "/Images/Buttons/ST_Min_r.jpg"
	tH = "<SPAN CLASS=mySubHeader>" + wName + "</SPAN>"
	tW = "E-MR Shopping Centre"
	wB = "#000000"
	wBs = "#000000"
	wBG = "#FFFFFF BACKGROUND=/Images/Headers/BTitleBar.jpg"
	wBGs = "#FFFFFF BACKGROUND=/Images/Headers/BTitleBar.jpg"
	wNS = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=auto,resizable=1'
	fSO = 'scrolling=auto,resizable=1'
	brd = 1
	max = 1
	min = 1
	res = 1
	tsz = 22
	
	mywindow=chromeless(u,n,W,H,X,Y,cU,cO,cL,mU,mO,xU,xO,rU,rO,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO,brd,max,min,res,tsz) 

}

function format(expr, decplaces){
	
	var str = "" + Math.round(eval(expr) * Math.pow(10,decplaces))
	while (str.length <= decplaces){
		str = "0" + str
	}
	var decpoint = str.length - decplaces
	return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length)
}

function showCat(ref){
	top.mainAction.shop.document.location = "/Store/E-MR/ProdFrm.asp?c=" + ref
}

function catRollover(obj){
	obj.style.backgroundColor = "#F48602"
	obj.style.backgroundImage = 'url(/Images/Buttons/Cat_r.jpg)'
	obj.style.color = '#FFFFFF'	
	obj.style.textAlign = 'right'	
}

function catRollOut(obj){
	obj.style.backgroundColor = "#FFFFFF"
	obj.style.backgroundImage = 'url(/Images/Buttons/Cat_n.jpg)'
	obj.style.color = '#330000'
	obj.style.textAlign ='left'	
}

function catRollDown(obj){
	obj.style.backgroundColor = "#FFFFFF"
	obj.style.backgroundImage = 'url(/Images/Buttons/Cat_d.jpg)'
	obj.style.color = '#FF9900'
	obj.style.textAlign ='center'	
}

function openPrivacy(){
	openNewWindow(500,400,"Privacy.htm","Customer",0,1,1,1,0)

}
