

Rollimage = new Array();
   
Rollimage[0] = new Image(25,25) ;
Rollimage[0].src = "../images/info_arrow_off_green.gif";
Rollimage[0].border = "0px";

Rollimage[1] = new Image(25,25);
Rollimage[1].src = "../images/info_arrow_on_green.gif";
Rollimage[1].border = "0px";
// Indicates that a toggle has been switched on
var blnToggle 	= false;
var strImgName 	= "";
var strLinkId 	= "";
function AlertAuthorityStatus()
{
	alert("This prescription requires an authority");
}
function toggle_image(targetid, name, imgID, prodId)
{
	
	// Conditional to test if hidden layer has been activated if so close it
	if (blnToggle)
	{
		// Set target object for already open layer
		target = document.getElementById(strLinkId);
		// Hide it
		target.style.display="none";
		// Set image to off state
		document.images[strImgName].src = Rollimage[0].src;
		blnToggle = false;
		if (strImgName != name && strLinkId != targetid )
		{
		// Now set up first or subsequent hit
			target = document.getElementById(targetid);
			target.style.display="";
			document.images[name].src = Rollimage[1].src;
			blnToggle 	= true;
			strImgName 	= name;
			strLinkId 	= targetid;
			//alert("SubStart!!!!");
		}
		//alert("Start!!!!");
	}
	// Conditional that tests whether or not the same link has been opened and closed
	// Above conditional will close an already open link including the same one clicked 
	// opened then closed. This conditional will open a new link so long as its not the same link
	else if (strImgName != name && strLinkId != targetid )
	{
	// Now set up first or subsequent hit
		target = document.getElementById(targetid);
		target.style.display="";
		document.images[name].src = Rollimage[1].src;
		document.getElementById(imgID).style.borderWidth = "0px 0px 0px 0px";

		//var img;
		//images[name].styles.borderWidth = '0px';
		//document.images[name].style.borderWidth = "0px";
		//var imgs;
 		//imgs = document.getElementsByTagName(name);
		//imgs[0].style.border = '0px dashed #ccc';
		blnToggle 	= true;
		strImgName 	= name;
		strLinkId 	= targetid;
		//alert("Middle!!!!");
	}
	//Executes if opened and closed twice ie blnToggle = false and same image tag
	else
	{
	// Now set up first or subsequent hit
		target = document.getElementById(targetid);
		target.style.display="";
		document.images[name].src = Rollimage[1].src;
		document.getElementById(imgID).style.borderWidth = "0px 0px 0px 0px";

		//images[name].styles.borderWidth = '0px';
		//var imgs;
 		//imgs = document.getElementsByTagName(name);
		//imgs[0].style.border = '0px dashed #ccc';
		blnToggle 	= true;
		strImgName 	= name;
		strLinkId 	= targetid;
		//alert("End!!!!");
	}	
}

function alterBgColor()
{
//alert(id + " " + trTop + " " + trBot);
	if(document.getElementsByTagName)
	{  
		 document.getElementById("top").style.backgroundColor="#FFFFFF"
		 document.getElementById("mid").style.backgroundColor="#FFFFFF"
		 document.getElementById("bot").style.backgroundColor="#FFFFFF"
		return true;
	}
	else
 		return false;
}
function B_product_redirect(prodkey) {
	flag = confirm("PLEASE NOTE\nIf you have a script for this product please Click Yes/Ok\nIf you do not have a script you can purchase by\nClicking No/Cancel");
	if (flag) {
		window.location.href = "/prescrip/pselect.asp?ProdID="+prodkey;
	}
	else {
		window.location.href = "/search/getprod.asp?myProdId="+prodkey;
	}
}
function jumpPage(newLoc){

newPage = newLoc.options[newLoc.selectedIndex].value
if (newPage !=""){
document.Categories.newCategory.selectedIndex = 0
window.location.href = newPage
}
else{
document.Categories.newCategory.selectedIndex = 0
}
}
function findLinkByText(myText) {	
	for (var i = 0; i < document.links.length; i++)
	{
		if (document.links[i].text.indexOf(myText)) 	return i;
	}
	return -1;
}
function queueChanges(prodKey, prescTypeId)
{
	var myText;
	var myUrl;
	var myId;
	var dud;
	if (prescTypeId == "2")
	{
		// This is for first Button You ARE a Repat card holder
		myText = "You ARE a";
		myUrl = "/prescrip/pselect.asp?ProdID=" + prodKey;
		myId = "idPT2Yes";
		dud = changeLinkHref(myId, myUrl, myText);		//This might need assignment
		// This is for second Button You are NOT  a Repat card holder
		myText = "You Are NOT";	
		myUrl = "/search/getprod.asp?myProdId=" + prodKey;	
		myId = "idPT2No";
		dud = changeLinkHref(myId, myUrl, myText);		//This might need assignment as well
	}
	if (prescTypeId == "3")
	{
		// This is for first Button You ARE a Repat card holder
		myText = "You ARE a";
		myUrl = "/prescrip/pselect.asp?ProdID=" + prodKey;
		myId = "idPT3Yes";
		dud = changeLinkHref(myId, myUrl, myText);		//This might need assignment
		// This is for second Button You are NOT  a Repat card holder
		myText = "You Are NOT";	
		myUrl = "/prescrip/pselect.asp?ProdID=" + prodKey+"&notvar=Yes";
		myId = "idPT3No";
		dud = changeLinkHref(myId, myUrl, myText);		//This might need assignment as well
	}
	if (prescTypeId == "1")
	{
		// This is for first Button You ARE a Repat card holder
		myText = "YES,";
		myUrl = "/prescrip/pselect.asp?ProdID=" + prodKey;
		myId = "idPT1Yes";
		dud = changeLinkHref(myId, myUrl, myText);		//This might need assignment
		// This is for second Button You are NOT  a Repat card holder
		myText = "NO,";	
		myUrl = "/search/getprod.asp?myProdId=" + prodKey;
		myId = "idPT1No";
		dud = changeLinkHref(myId, myUrl, myText);		//This might need assignment as well
	}
	if (prescTypeId == "4")
	{
		// This is for first Button You ARE a Repat card holder
		myText = "YES, I have a a Conce";
		myUrl = "/prescrip/pselect.asp?ProdID=" + prodKey;
		myId = "idPT4Yes";
		dud = changeLinkHref(myId, myUrl, myText);		//This might need assignment
		// This is for second Button You are NOT  a Repat card holder
		myText = "NO, I haven't a Conc";	
		myUrl = "/search/getprod.asp?myProdId=" + prodKey;
		myId = "idPT4No";
		dud = changeLinkHref(myId, myUrl, myText);		//This might need assignment as well
	}
}
function changeLinkHref(id, myUrl, myText)
{
	//document.write ("Hello id " + id + " url " + myUrl + " text " + myText);
	if (document.links.length > 0) 
	{
		if (document.getElementById) 
		{
			document.getElementById(id).href = myUrl;
		}
		else if (document.all) 
		{
			document.all[id].href = myUrl;
		}
		else 
		{
			// This is the old Netscape section
			var index = findLinkByText(myText);
			if (index > -1)
			document.links[index].href = myUrl;
		}
	}
  return 1;
}
function show_it(objName, prodKey, prescTypeId)
{
	//window.status='Select this item';
	var scr
	//scr = getScreenDim(objName);
	if (document.getElementById)
	{
		document.getElementById(objName).style.visibility = "visible";
	}
	else 
	{
		document.objName.visibility = "visible"
	}
	queueChanges(prodKey, prescTypeId);
}
//ends open function
function hide_it(objName)
{
	if (document.getElementById)
	{
		document.getElementById(objName).style.visibility = "hidden";
	}
	else
	{
		document.objName.visibility = "hidden";
	}
}

function quantityCheck(fieldName, maxQty) {
	var i;
	for(i=0;i<document.recalc.elements.length;i++){
		if (document.recalc.elements[i].name==fieldName) {
			if ((document.recalc.elements[i].value > maxQty) && (maxQty > 0))	{
				alert("Maximum quantity for this product is "+maxQty)
				document.recalc.elements[i].focus()
				document.recalc.elements[i].select()
				return false
		  }
		}
	}
}

function field(myName) {
	this.name = myName;
}


var PharmMsg;
PharmMsg = "This item must be personally handed by a pharmacist to you.  However it can be provided over the internet if a doctor's prescription is sent to us.  \n\nDo you wish to purchase this item?";


function searchCheck() {

// Ensure search field is not left blank

	if (document.Categories.SearchString.value == ""){
	
		alert('Please Enter Search Name !'); document.Categories.SearchString.focus(); return false
		}
	
return true
}
function toggle_info(targetid)
{
	
	// Conditional to test if hidden layer has been activated if so close it
	if (blnToggle)
	{
		// Set target object for already open layer
		target = document.getElementById(strLinkId);
		// Hide it
		target.style.display="none";
		// Set image to off state
		//document.images[strImgName].src = Rollimage[0].src;
		blnToggle = false;
		if (strLinkId != targetid )
		{
		// Now set up first or subsequent hit
			target = document.getElementById(targetid);
			target.style.display="";
			//document.images[name].src = Rollimage[1].src;
			blnToggle 	= true;
			//strImgName 	= name;
			strLinkId 	= targetid;
			//alert("SubStart!!!!");
		}
		//alert("Start!!!!");
	}
	// Conditional that tests whether or not the same link has been opened and closed
	// Above conditional will close an already open link including the same one clicked 
	// opened then closed. This conditional will open a new link so long as its not the same link

	else
	{
	// Now set up first or subsequent hit
		target = document.getElementById(targetid);
		target.style.display="";
		//document.images[name].src = Rollimage[1].src;
		//document.getElementById(imgID).style.borderWidth = "0px 0px 0px 0px";

		//images[name].styles.borderWidth = '0px';
		//var imgs;
 		//imgs = document.getElementsByTagName(name);
		//imgs[0].style.border = '0px dashed #ccc';
		blnToggle 	= true;
		strImgName 	= name;
		strLinkId 	= targetid;
		//alert("End!!!!");
	}	
}

function load(uri, name, y, x)
{
	var win;
	y = y + 30;
	x = x + 20;
	//alert(uri);
	//win = window.open(uri, name, 'scrollbars=0, menubar=0, height='+x+', width='+y+', resizable=0, toolbar=0, location=0, status=0');
	win = window.open(uri, name, 'width='+x+',height='+y+', scrollbars=0, menubar=0, location=0' );
}


function swapLayer(targetid)
{
	
	// Conditional to test if hidden layer has been activated if so close it
	if (blnToggle)
	{
		// Set target object for already open layer
		target = document.getElementById(strLinkId);
		// Hide it
		target.style.display="none";
		blnToggle = false;
		if (strLinkId != targetid )
		{
		// Now set up first or subsequent hit
			target = document.getElementById(targetid);
			target.style.display="";
			blnToggle 	= true;
			strLinkId 	= targetid;
			//alert("SubStart!!!! "+targetid);
		}
		//alert("Start!!!!");
	}
	// Conditional that tests whether or not the same link has been opened and closed
	// Above conditional will close an already open link including the same one clicked 
	// opened then closed. This conditional will open a new link so long as its not the same link
	else if (strLinkId != targetid )
	{
	// Now set up first or subsequent hit
		target = document.getElementById(targetid);
		target.style.display="";
		blnToggle 	= true;
		strLinkId 	= targetid;
		//alert("Middle!!!! "+targetid);
		
	}
	//Executes if opened and closed twice ie blnToggle = false and same image tag
	else
	{
	// Now set up first or subsequent hit
		target = document.getElementById(targetid);
		target.style.display="";
		blnToggle 	= true;
		strLinkId 	= targetid;
		//alert("End!!!! "+targetid);
	}	
}
function SuppInfo(theForm)
{
if (document.SuppRego.FirstName.value == "") 
{
	alert("Please enter a first name")
	document.SuppRego.FirstName.focus()
	document.SuppRego.FirstName.select()
	return false;
}

if (document.SuppRego.LastName.value == "") 
{
	alert("Please enter a last name")
	document.SuppRego.LastName.focus()
	document.SuppRego.LastName.select()
	return false;
}

if (document.SuppRego.Email.value == "") 
{
	alert("Please enter a valid email")

	document.SuppRego.Email.focus()
	document.SuppRego.Email.select()
	return false;
}

if (document.SuppRego.Phone.value == "") 
{
	alert("Please enter a contact phone")
	document.SuppRego.Phone.focus()
	document.SuppRego.Phone.select()
	return false;
}



}

function suppProd()
{
	//
	// branded product extension Radio button processing
	//
	var found = false;
	for (var i = 0; i < document.NewProd.BrandProdExt.length; i++)
	{
		if (document.NewProd.BrandProdExt[i].checked) 
		{
			found = true;
			break;
		}
	}
	if (!found)
	{
		alert("Please select whether this is a well known brand")
		document.NewProd.BrandProdExt[0].focus();
		//document.NewProd.BrandProdExt.select();
		return false;
	}
	//
	// GSTStatus radio validate
	//
	found = false;
	for (var i = 0; i < document.NewProd.GSTStatus.length; i++)
	{
		if (document.NewProd.GSTStatus[i].checked) 
		{
			found = true;
			break;
		}
	}
	if (!found)
	{
		alert("Please select the GST status of this product")
		document.NewProd.GSTStatus[0].focus();
		//document.NewProd.BrandProdExt.select();
		return false;
	}	
	
	//
	// CommitToFullCredit radio validate
	//
	found = false;
	for (var i = 0; i < document.NewProd.CommitToFullCredit.length; i++)
	{
		if (document.NewProd.CommitToFullCredit[i].checked) 
		{
			found = true;
			break;
		}
	}
	if (!found)
	{
		alert("Please select a Commit To Full Credit option")
		document.NewProd.CommitToFullCredit[0].focus();
		//document.NewProd.BrandProdExt.select();
		return false;
	}	
	//
	// PDEOrder radio validate
	//
	found = false;
	for (var i = 0; i < document.NewProd.PDEOrder.length; i++)
	{
		if (document.NewProd.PDEOrder[i].checked) 
		{
			found = true;
			break;
		}
	}
	if (!found)
	{
		alert("Please select a ordering type")
		document.NewProd.PDEOrder[0].focus();
		//document.NewProd.BrandProdExt.select();
		return false;
	}		
	
	if (document.NewProd.ProdDesc.value == "") 
	{
		alert("Please enter a product description")
		document.NewProd.ProdDesc.focus()
		document.NewProd.ProdDesc.select()
		return false;
	}
	//alert("Hi there");
	
	if (document.NewProd.APN.value == "") 
	{
		alert("Please enter a product name APN or barcode")
		document.NewProd.APN.focus()
		document.NewProd.APN.select()
		return false;
	}
	else 
	{
		document.NewProd.APN.value = Trim(document.NewProd.APN.value); // kill whitespace leading and trailing
		if (IsApn(document.NewProd.APN.value) == false)
		{
			alert("APN has to be entirely numeric, if you have added hyphens or similar, please remove them")
			document.NewProd.APN.focus()
			document.NewProd.APN.select()
			return false;
		}
	}
		
	if (document.NewProd.PDE.value == ""  || !IsNumeric(document.NewProd.PDE.value)  ) 
	{
		alert("Please enter a valid PDE code")
		document.NewProd.PDE.focus()
		document.NewProd.PDE.select()
		return false;
	}
	if (document.NewProd.PDE.value == ""  || !IsNumeric(document.NewProd.PDE.value)  ) 
	{
		alert("Please enter a valid PDE code")
		document.NewProd.PDE.focus()
		document.NewProd.PDE.select()
		return false;
	}	
	
	/*
	if (document.NewProd.GSTStatus.value == ""  || !IsNumeric(document.NewProd.GSTStatus.value)  ) 
	{
		alert("Please select a value for GST Status")
		document.NewProd.GSTStatus.focus()
		document.NewProd.GSTStatus.select()
		return false;
	}
	*/
	/*
	if (document.NewProd.CommitToFullCredit.value == ""  || !IsNumeric(document.NewProd.CommitToFullCredit.value)  ) 
	{
		alert("Please select a value for commit to full credit")
		document.NewProd.CommitToFullCredit.focus()
		document.NewProd.CommitToFullCredit.select()
		return false;
	}
	*/
	//alert("bi there");
	/*
	if (document.NewProd.PDEOrder.value == ""  || !IsNumeric(document.NewProd.PDEOrder.value)  ) 
	{
		alert("Please select a value for PDE ordering")
		document.NewProd.PDEOrder.focus()
		document.NewProd.PDEOrder.select()
		return false;
	}	
	*/
	if (document.NewProd.StoreDept.value == "") 
	{
		alert("Please enter a valid Store Department")
		document.NewProd.StoreDept.focus()
		document.NewProd.StoreDept.select()
		return false;
	}
		
	/* DELETED
	if (document.NewProd.MarketShare.value == "" ) 
	{
		alert("Please enter market share data")
		document.NewProd.MarketShare.focus()
		document.NewProd.MarketShare.select()
		return false;
	}
	*/
	/* DELETED
	if (document.NewProd.AnticipatedShare.value == ""   || !IsNumeric(document.NewProd.AnticipatedShare.value) ) 
	{
		alert("Please enter Anticipated market share"  )
		document.NewProd.AnticipatedShare.focus()
		document.NewProd.AnticipatedShare.select()
		return false;
	}
	*/
	/* DELETED
	if (document.NewProd.HowAchieved.value == "" ) 
	{
		alert("Please enter how marketshare will be achieved")
		document.NewProd.HowAchieved.focus()
		document.NewProd.HowAchieved.select()
		return false;
	}
	*/
	/* DELETED
	if (document.NewProd.CurOZEProSpend.value == ""   || !IsNumeric(document.NewProd.CurOZEProSpend.value) ) 
	{
		alert("Please enter Current OZE-Pharmacy Co-promotional spend")
		document.NewProd.CurOZEProSpend.focus()
		document.NewProd.CurOZEProSpend.select()
		return false;
	}
	*/
	//alert("Step 1");
	if (document.NewProd.AnticipatedSalesByUnits.value == ""   || !IsInteger(document.NewProd.AnticipatedSalesByUnits.value)) 
	{
		alert("Please enter Anticipated Sales by units for NEW Product.\r\n For example 2000000.")
		document.NewProd.AnticipatedSalesByUnits.focus()
		document.NewProd.AnticipatedSalesByUnits.select()
		return false;
	}
	if (document.NewProd.AdvertSpend.value == ""   || !IsNumeric(document.NewProd.AdvertSpend.value)) 
	{
		alert("Please enter advertised spend for NEW Product.\r\n For example 100000 represents 100000 dollars so you would type in 100000.")
		document.NewProd.AdvertSpend.focus()
		document.NewProd.AdvertSpend.select()
		return false;
	}
	
	if (document.NewProd.AnticipatedProSpend.value == ""   || !IsNumeric(document.NewProd.AnticipatedProSpend.value)) 
	{
		alert("Please enter Budget allocation to Ozepharmacy for new line introduction and promotion.\r\nThis would be a dollar value, without the dollar sign.")
		document.NewProd.AnticipatedProSpend.focus()
		document.NewProd.AnticipatedProSpend.select()
		return false;
	}
	
	if (document.NewProd.TradeTermDiscount.value == ""  || !IsNumeric(document.NewProd.TradeTermDiscount.value) ) 
	{
		alert("Please enter  Trade term Initial buy discount.")
		document.NewProd.TradeTermDiscount.focus()
		document.NewProd.TradeTermDiscount.select()
		return false;
	}
	
	//TradeTermRange TradeTermDiscount
	/* DELETED
	if (document.NewProd.TradeTermRange.value == ""   || !IsNumeric(document.NewProd.TradeTermRange.value)) 
	{
		alert("Please enter  Trade term range")
		document.NewProd.TradeTermRange.focus()
		document.NewProd.TradeTermRange.select()
		return false
	}
	*/
	if (document.NewProd.TradeTermOngoing.value == ""  || !IsNumeric(document.NewProd.TradeTermOngoing.value)) 
	{
		alert("Please enter Trade term Everyday discount");
		document.NewProd.TradeTermOngoing.focus();
		document.NewProd.TradeTermOngoing.select();
		return false;
	}
	
	if (document.NewProd.BBPriceSymbion.value == "" || !IsNumeric(document.NewProd.BBPriceSymbion.value)) 
	{
		alert("Please enter Symbion list price");
		document.NewProd.BBPriceSymbion.focus();
		document.NewProd.BBPriceSymbion.select();
		return false;
	}
	if (document.NewProd.BBPriceSigma.value == "" || !IsNumeric(document.NewProd.BBPriceSigma.value)) 
	{
		alert("Please enter Sigma list price");
		document.NewProd.BBPriceSigma.focus();
		document.NewProd.BBPriceSigma.select();
		return false;
	}	
	if (document.NewProd.BBPriceAPI.value == "" || !IsNumeric(document.NewProd.BBPriceAPI.value)) 
	{
		alert("Please enter API list price");
		document.NewProd.BBPriceAPI.focus();
		document.NewProd.BBPriceAPI.select();
		return false;
	}		

	if (document.NewProd.RRP.value == "" || !IsNumeric(document.NewProd.RRP.value)) 
	{
		alert("Please enter RRP");
		document.NewProd.RRP.focus();
		document.NewProd.RRP.select();
		return false;
	}
	
	
	if (document.NewProd.NISPrice.value == ""  || !IsNumeric(document.NewProd.NISPrice.value)) 
	{
		alert("Please enter RRP");
		document.NewProd.NISPrice.focus();
		document.NewProd.NISPrice.select();
		return false;
	}
	
	if (document.NewProd.ProdDimHT.value == ""  || !IsNumeric(document.NewProd.ProdDimHT.value)) 
	{
		alert("Please enter Product Package Height");
		document.NewProd.ProdDimHT.focus();
		document.NewProd.ProdDimHT.select();
		return false;
	}
	else
	{
		if (document.NewProd.ProdDimHT.value > 50)
		{
			alert("Product height exceeds limit of 50 centimeters");
			document.NewProd.ProdDimHT.focus();
			document.NewProd.ProdDimHT.select();
			return false;
		}
		//return true;
	}
	
	if (document.NewProd.ProdDimWT.value == ""  || !IsNumeric(document.NewProd.ProdDimWT.value)) 
	{
		alert("Please enter Product Package Width");
		document.NewProd.ProdDimWT.focus();
		document.NewProd.ProdDimWT.select();
		return false;
	}
	else
	{
		if (document.NewProd.ProdDimWT.value > 50)
		{
			alert("Product width exceeds limit of 50 centimeters");
			document.NewProd.ProdDimWT.focus();
			document.NewProd.ProdDimWT.select();
			return false;
		}
		//return true;
	}
	
	if (document.NewProd.ProdDimDP.value == ""  || !IsNumeric(document.NewProd.ProdDimDP.value)) 
	{
		alert("Please enter Product Package Depth");
		document.NewProd.ProdDimDP.focus();
		document.NewProd.ProdDimDP.select();
		return false;
	}
	else
	{
		if (document.NewProd.ProdDimDP.value > 50)
		{
			alert("Product depth exceeds limit of 50 centimeters");
			document.NewProd.ProdDimDP.focus();
			document.NewProd.ProdDimDP.select();
			return false;
		}
		//return true;
	}
	if (document.NewProd.file2.value == "" ) 
	{
		alert("Please select an image to upload");
		document.NewProd.file2.focus();
		document.NewProd.file2.select();
		return false;
	}
	else
	{
		//
		// check for valid file extension
		//
		var arrExt = [
						".bmp",
						".emf",
						".gif",
						".jpg",
						".jpeg",
						".png",
						".tga",
						".tif",
						".wmf"
					]
		
		var str = document.NewProd.file2.value;
		str = Trim(str);
		var bool = false;
		//
		// check for period, period!
		//
		if (str.lastIndexOf('.') != -1)
		{
			var ext = str.substring(str.lastIndexOf('.'), str.length).toLowerCase();
			for(i = 0; i < arrExt.length; i++)
				if (ext == arrExt[i])
					bool = true;
			//
			// bad vibe, better warn
			//
			if (!bool)
			{
				alert("Invalid image file extension '" + ext + "'. Please use one of the following formats.\r\n\r\n"
					+ 	"\t.bmp\r\n"
					+	"\t.emf\r\n"
					+	"\t.gif\r\n"
					+	"\t.jpg\r\n"
					+	"\t.jpeg\r\n"
					+	"\t.png\r\n"
					+	"\t.tga\r\n"
					+	"\t.tif\r\n"
					+	"\t.wmf\r\n"
				  );		
				document.NewProd.file2.focus();
				document.NewProd.file2.select();
				return false;
			}
		}
		//
		// no extension
		//
		else
		{
			alert("Invalid image file extension. There appears to be none. Please use one of the following formats.\r\n\r\n"
				+ 	"\t.bmp\r\n"
				+	"\t.emf\r\n"
				+	"\t.gif\r\n"
				+	"\t.jpg\r\n"
				+	"\t.jpeg\r\n"
				+	"\t.png\r\n"
				+	"\t.tga\r\n"
				+	"\t.tif\r\n"
				+	"\t.wmf\r\n"
			  );		
			document.NewProd.file2.focus();
			document.NewProd.file2.select();			
			return false;
		}
	}
	if (document.NewProd.Keywords.value == "" ) 
	{
		alert("Please input some keywords to define your product");
		document.NewProd.Keywords.focus();
		document.NewProd.Keywords.select();
		return false;
	}
	
	
// This will check possible combos of file fields
// and set a hidden field with value from 0 to 3
// 0 = No files
// 1 = file1 only
// 2 = file2 only
// 3 = file1 and file2
//
	var myString1 = "";
	var myString2 = "";
	
	//document.SuppRego.file1.value.trim();
	//document.SuppRego.file2.value.trim();
	
	myString1 = document.NewProd.file1.value;
	myString2 = document.NewProd.file2.value;
	//alert(myString1);
	//alert(myString2);	
	//
	// No files uploaded	set = 0
	//
	//alert("Executed?");
	if (myString1.trim() == "" && myString2.trim() == "")
	{
		document.NewProd.FileCode.value = '0';
		//alert("val 0 " + document.NewProd.FileCode.value);
	}
	//
	// For first file1 only
	//
	else if (myString1.trim() != "" && myString2.trim() == "")
	{
		document.NewProd.FileCode.value = '1';
		//alert("val 1 " + document.NewProd.FileCode.value);		
	}
	//
	// Only 2nd file
	//
	else if (myString1.trim() == "" && myString2.trim() != "")
	{
		document.NewProd.FileCode.value = '2';
		//alert("val 2 " + document.NewProd.FileCode.value);		
	}
	//
	// Both files
	//
	else if (myString1.trim() != "" && myString2.trim() != "")
	{
		document.NewProd.FileCode.value = '3';
		//alert("val 3 " + document.NewProd.FileCode.value);		
	}
	//
	// some code to remind user to input
	// dimensions in centimetters
	// this code must be at end of any code
	// validation
	var wt = document.NewProd.ProdDimWT.value;
	var ht = document.NewProd.ProdDimHT.value;
	var dt = document.NewProd.ProdDimDP.value;
	var msg = "System requires that all dimensions are in centimeters with a maximum of 50cm for any side.\r\n"
				+ "Please review the following listed values...\r\n\r\n"
				+ "\tHeight\t=\t" + ht + "\tcm\r\n"
				+ "\tWidth\t=\t" + wt + "\tcm\r\n"
				+ "\tDepth\t=\t" + dt + "\tcm\r\n"			
				+ "\r\n"
				+ "Is this correct?\r\n";

	var result = false;
	var result = confirm(msg);
	if (!result)
	{
		// a change of heart, focus to first dim height
		//alert("I have changed my mind");
		document.NewProd.ProdDimHT.focus();
		document.NewProd.ProdDimHT.select();
		return false;
	}			
	else
	{
		// i like my measurments
		//alert("No these will do nicely");
		return true;
	}
}


function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}
function IsInteger(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}
function IsApn(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}   

var newwindow;
function poptastic(path, image, name, width, height)
{
	alert(path+","+ image +","+ name +","+ width +","+ height);
	var url;
	var parms;
	path = "supplier_portal/";
	url = "'"+path+image+"',  Name='"+name+"'";
	parms = ", 'height="+height+",width="+width+",menubar=0, scrollbars=1'";
	alert(parms);
	//url = 'openwindow.asp?Path=userimages&Image=cat_entry.jpg&PetName=Claude';
	alert( url+parms);
	
	newwindow=window.open(url,'PetImage', parms);
	if (window.focus) {newwindow.focus();}

}


var ImageFolder = "http://www.vetalogica.com.au/Product_Images/thumbs"; //Folder name containing the images

var ImageFileNames = new Array(	'cannine joint support.jpg',
				'cannine multi immune.jpg',
				'cannine omegaderm.jpg',
				'cannine total ORAL.jpg',
				'cannine prodigestve ultra.jpg',
				'cannine senoir multi.jpg',
				'cannine slim extract.jpg',
				'cannine tranquil.jpg',
				'feline joint support.jpg',
				'feline multi plus immune.jpg',
				'feline omegaderm.jpg',
				'feline total ORAL.jpg',
				'feline prodigestve ultra.jpg',
				'feline senoir multi.jpg',
				'feline slim extract.jpg',
				'feline tranquil.jpg'); //List of images to use
/*
var ImageURLs = new Array(	'http://www.vetalogica.com.au/Products/CanineJointSupport.asp',
				'http://www.vetalogica.com.au/Products/CanineMultiImmune.asp',
				'http://www.vetalogica.com.au/Products/CanineOmegaderm.asp',
				'http://www.vetalogica.com.au/Products/CanineTotalOralDefence.asp',
				'http://www.vetalogica.com.au/Products/CanineProdigestiveUltra.asp',
				'http://www.vetalogica.com.au/Products/CanineSeniorMulti.asp',
				'http://www.vetalogica.com.au/Products/CanineSlimExtract.asp',
				'http://www.vetalogica.com.au/Products/CanineTranquil.asp',
				'http://www.vetalogica.com.au/Products/FelineJointSupport.asp',
				'http://www.vetalogica.com.au/Products/FelineMultiImmune.asp',
				'http://www.vetalogica.com.au/Products/FelineOmegaderm.asp',
				'http://www.vetalogica.com.au/Products/FelineTotalOralDefence.asp',
				'http://www.vetalogica.com.au/Products/FelineProdigestiveUltra.asp',
				'http://www.vetalogica.com.au/Products/FelineSeniorMulti.asp',
				'http://www.vetalogica.com.au/Products/FelineSlimExtract.asp',
				'http://www.vetalogica.com.au/Products/FelineTranquil.asp');
*/

var ImageURLs = new Array(	'Products/CanineJointSupport.asp',
							'Products/CanineMultiImmune.asp',
							'Products/CanineOmegaderm.asp',
							'Products/CanineTotalOralDefence.asp',
							'Products/CanineProdigestiveUltra.asp',
							'Products/CanineSeniorMulti.asp',
							'Products/CanineSlimExtract.asp',
							'Products/CanineTranquil.asp',
							'Products/FelineJointSupport.asp',
							'Products/FelineMultiImmune.asp',
							'Products/FelineOmegaderm.asp',
							'Products/FelineTotalOralDefence.asp',
							'Products/FelineProdigestiveUltra.asp', 
							'Products/FelineSeniorMulti.asp',
							'Products/FelineSlimExtract.asp',
							'Products/FelineTranquil.asp' );

var ImageDesc = new Array(	'Canine<BR>Joint Support',
							'Canine<BR>Multi+Immune Complex',
							'Canine<BR>Omegaderm™',
							'Canine<BR>Total Oral Defence™',
							'Canine<BR>Prodigestive Ultra™',
							'Canine<BR>Senior Multi',
							'Canine<BR>Slim Extract™',
							'Canine<BR>Tranquil Formula',
							'Feline<BR>Joint Support',
							'Feline<BR>Multi+Immune Complex',
							'Feline<BR>Omegaderm™',
							'Feline<BR>Total Oral Defence™',
							'Feline<BR>Prodigestive Ultra™',
							'Feline<BR>Senior Multi',
							'Feline<BR>Slim Extract™',
							'Feline<BR>Tranquil Formula');

var myProdDiv = document.getElementById("prod");
 //List of hyperlinks associated with the list of images

var DefaultURL = 'http://www.vetalogica.com.au/Products.asp'; 		//Default hyperlink for the Banner Ad
var DisplayInterval = 5; 						//Number of seconds to wait before the next image is displayed
var TargetFrame = "_blank"; 							//Name of the frame to open the hyperlink into

//Internal variables (do not change these unless you know what you are doing)
var IsValidBrowser = false;
var BannerAdCode = 0;
var BannerAdImages = new Array(NumberOfImages);
var DisplayInterval = DisplayInterval * 1000;
var NumberOfImages = ImageFileNames.length;

//Add a trailing forward slash to the ImageFolder variable if it does not already have one
if (ImageFolder.substr(ImageFolder.length - 1, ImageFolder.length) != "/" && ImageFolder != "") 
{ 
	ImageFolder += "/";
}

if (TargetFrame == '') 
{
	var FramesObject = null;
} 
else 
{
	var FramesObject = eval('parent.' + TargetFrame);
}

function WriteLayer(ID,parentID,sText) 
{
	 if (document.layers) 
	 {
		var oLayer;
	 	if(parentID)
		{
			oLayer = eval('document.' + parentID + '.document.' + ID + '.document');
   		}
		else
		{
			oLayer = document.layers[ID].document;
		}
	oLayer.open();
	oLayer.write(sText);
	oLayer.close();
 	}
 	else if (parseInt(navigator.appVersion)>=5&&navigator.appName=="Netscape") 
 	{
		document.getElementById(ID).innerHTML = sText;
 	}
	else if (document.all) document.all[ID].innerHTML = sText
} 
//Function runs when this page has been loaded and does the following:
//1. Determine the browser name and version  (since the script will only work on Netscape 3+ and Internet Explorer 4+).
//2. Start the timer object that will periodically change the image displayed by the Banner Ad.
//3. Preload the images used by the Banner Ad rotator script
function InitialiseBannerAdRotator() 
{

	//Determine the browser name and version
	//The script will only work on Netscape 3+ and Internet Explorer 4+
	var BrowserType = navigator.appName;
	var BrowserVersion = parseInt(navigator.appVersion);
	
	if (BrowserType == "Netscape" && (BrowserVersion >= 3)) 
	{
		IsValidBrowser = true;
	}
	
	if (BrowserType == "Microsoft Internet Explorer" && (BrowserVersion >= 4)) 
	{
		IsValidBrowser = true;
	}
	
	if (IsValidBrowser) 
	{
		TimerObject = setTimeout("ChangeImage()", DisplayInterval);
		BannerAdCode = 0;
	
		for (i = 0; i < NumberOfImages; i++) 
		{
			BannerAdImages[i] = new Image();
			BannerAdImages[i].src = ' ' + ImageFolder + ImageFileNames[i];
		}
	
	}

}

//Function to change the src of the Banner Ad image
function ChangeImage() {

	if (IsValidBrowser) 
	{
		BannerAdCode = BannerAdCode + 1;
	
		if (BannerAdCode == NumberOfImages) 
		{
			BannerAdCode = 0;
		}
	
		window.document.bannerad.src = BannerAdImages[BannerAdCode].src;
		WriteLayer('prod', null, ImageDesc[BannerAdCode]);
		TimerObject = setTimeout("ChangeImage()", DisplayInterval);
	}
}

//Function to redirect the browser window/frame to a new location,
//depending on which image is currently being displayed by the Banner Ad.
//If Banner Ad is being displayed on an old browser then the DefaultURL is displayed
function ChangePage() 
{
	
	if (IsValidBrowser) {
	
		if (TargetFrame != '' && (FramesObject)) 
		{
			FramesObject.location.href = ImageURLs[BannerAdCode];
		} 
		else 
		{
			document.location = ImageURLs[BannerAdCode];
			
		}
		
	} 
	else if (!IsValidBrowser) 
	{
		document.location = DefaultURL;
	}
}
function Trim(str) 
{
	return str.replace(/^\s+|\s+$/g,"");
}
function addtobasket(ProdKey, qty) {
	var url = '/cart/basketadd.asp?ProdID='+ ProdKey + '&Qty=' + qty
	document.location.href=url;
}