var screensize = window.screen.width

if(screensize < 800)
	{window.location.href="resolution.asp"}

var version = navigator.appVersion
var offset = ""
offset = version.indexOf("MSIE")
version = version.charAt(offset + 5)

//alert(navigator.appVersion)
var isNav, isIe

if(navigator.appName.indexOf("Netscape") != -1)
	{isNav = true}
else

if(navigator.appName.indexOf("Microsoft") != -1)
	{isIe = true}


	



function setBackground(thisOne,thisColour,textColour)

{
//alert(thisOne)
var obj

if (document.all)
		{
		
	//alert("IE")
		obj = document.all(thisOne).style.backgroundColor = thisColour
		
		obj = document.all("text"+thisOne).style.color = textColour		
		}
		
	else if (document.getElementById)
		{
		//alert("netscapev6+")
		obj = document.getElementById(thisOne).style.backgroundColor = thisColour
		
		obj = document.getElementById("text"+thisOne).style.color = textColour
		}
		
	else if (document.layers)
		{
		//alert("netscapev4")
		obj = ""
		}
		
}


function setBackgroundImage(thisOne,thisColour,textColour)

{

	var obj

if (document.all)
		{
		
	//alert("IE")
		obj = document.all("centre"+thisOne).style.backgroundColor = thisColour
		
		obj = document.all("text"+thisOne).style.color = textColour		
		}
		
	else if (document.getElementById)
		{
		//alert("netscapev6+")
		obj = document.getElementById("centre"+thisOne).style.backgroundColor = thisColour
		
		obj = document.getElementById("text"+thisOne).style.color = textColour
		}
		
	else if (document.layers)
		{
		//alert("netscapev4")
		obj = ""
		}

	
}



function getExternalLink()	{

	
	/* check the browser is capable of recognising the DOM objects
	   we need to implement the script - otherwise return false and allow the normal link to be executed */
	   
	if(!document.getElementsByTagName) return false;

	if(!document.getElementsByTagName("a")) return false;
	
	
	
	/* get a listing of all the <p> elements in the page. Then check each one for a title tag of "extLink"
	   If we find such an element, go get a listing of all the childNodes it contains.
	   Then check each one of these for any text which contains "www" - if we find one we know we have a hyperlink
	   so set the target attribute to _blank to force the link to open in a new browser window.
	   We also assign the hyperlink text to the title tag to display for the user */
	
	
	var links = document.getElementsByTagName("p"); 
	var textToSearch
	
	//alert(links.length)
						
	if (links.length > 0) {

					for(i = 0; i < links.length; i++) {
								

						if(links[i].getAttribute("title") == "extLink") {
							//var activeLink = links[i].getElementsByTagName("a")
							
							
							for(j = 0; j < links[i].childNodes.length; j++) {
							
								//alert(links[i].childNodes[j].nodeValue + j)

								textToSearch = new String(links[i].childNodes[j])
								
								
								
									if(textToSearch.match("www")) {
										
										
										links[i].childNodes[j].setAttribute("target", "_blank")
										links[i].childNodes[j].setAttribute("title", "link to " + links[i].childNodes[j])
									
										
									
									}
									
							}
						
						}
				

									
																									
					}
			
	}	   
	
}




var finalWidth = ""
var screenRes = window.screen.width /2
var viewerScreen = window.screen.width
var leftAnchor = ""

function create(thisWidth,thisHeight,thisProduct)
{

//alert(thisPrinter)
if(viewerScreen > 800)
{
finalWidth = parseInt(thisWidth)
finalWidth = finalWidth + 50
finalHeight = parseInt(thisHeight)
finalHeight = finalHeight + 10
}

else

{
finalWidth = parseInt(thisWidth)
finalWidth = finalWidth + 40
finalHeight = parseInt(thisHeight)
finalHeight = finalHeight + 10
}





leftAnchor = screenRes - (finalWidth / 2)
//alert("status=no,toolbar=no,title=no,location=no,scrollbars=yes,resizable=yes,screenX=100,left=" + leftAnchor + ", top=0")
//alert(finalWidth)



var writeBody = ""
//thisProduct = "view_" + thisCategory + ".asp?id=" + thisProduct + "&voltage=" + thisVoltage + "&category=" + thisCategory
//alert(thisProduct)
var newWin = window.open("","","status=no,toolbar=no,title=no,location=no,scrollbars=yes,resizable=yes,screenX=100,left=" + leftAnchor + ", top=0")
//alert(newWin.value)
if(newWin!=null || newWin.closed)

	{
	newWin.window.resizeTo(finalWidth,finalHeight)
	newWin.location = thisProduct
	newWin.document.close()
	}
}

function createForm(thisPage,thisWidth,thisHeight)
{
//alert(thisWidth)

if(viewerScreen > 800)
{
finalWidth = parseInt(thisWidth)
finalWidth = finalWidth + 0
finalHeight = parseInt(thisHeight)
finalHeight = finalHeight + 270
}

else

{
finalWidth = parseInt(thisWidth)
finalWidth = finalWidth + 0
finalHeight = parseInt(thisHeight)
finalHeight = finalHeight + 90
}





leftAnchor = screenRes - (finalWidth / 2)
//alert("status=no,toolbar=no,title=no,location=no,scrollbars=yes,resizable=yes,screenX=100,left=" + leftAnchor + ", top=0")
//alert(finalWidth)

var newWin = window.open(thisPage,"","status=no,toolbar=no,title=no,alwaysRaised=yes,location=no,scrollbars=yes,resizable=no,left=" + leftAnchor + ", top=0")
//alert(newWin)
if(newWin!=null || newWin.closed)

{
newWin.window.resizeTo(finalWidth,finalHeight)
newWin.document.close()
}


}




function focusOnUser()
{
document.forms[0].name.focus()
}

function focusOnLogin()
{
document.forms[0].username.focus()
}


function goSend()
{
//alert("send")
document.forms[0].submit()

}

function addToFavorite(favTitle)
{

if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) 

		{
		//alert(location.href)
		window.external.AddFavorite(location.href, unescape(favTitle));
		}
}


function verify(enquiry)
{


    if(enquiry.Company_Name.value == "")
  {
    alert("Please enter your company name.");
    enquiry.Company_Name.focus();
	enquiry.Company_Name.select();
    return (false);
  }
  
      if(enquiry.Contact_Name.value == "")
  {
    alert("Please enter a contact name.");
    enquiry.Contact_Name.focus();
	enquiry.Contact_Name.select();
    return (false);
  }
  
        if(enquiry.Address.value == "")
  {
    alert("Please enter a contact address.");
    enquiry.Address.focus();
    return (false);
  }     
  	
if(enquiry.Phone_Number.value == "")
  {
    alert("Please enter a contact telephone number.");
    enquiry.Phone_Number.focus();
	enquiry.Phone_Number.select();
    return (false);
  }
  
  
  
  var checkOK = "0123456789-+() \t\r\n\f";
  var checkStr = enquiry.Phone_Number.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only digits in the \"Telephone\" field.");
    enquiry.Phone_Number.focus()
	enquiry.Phone_Number.select()
    return (false);
  }
  

  if(enquiry.Contact_Email.value == "")
  {
    alert("An e-mail address is required for your confirmation.");
    enquiry.Contact_Email.focus();
	enquiry.Contact_Email.select()
    return (false);
  }
 

return (true);
}






