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 setSubMenu(thisOne,thisColour,textColour)

{
//alert(textColour)
var obj

if (document.all)
		{
		
	//alert("IE")
		obj = document.all(thisOne).style.backgroundColor = thisColour
		
		obj = document.all("text"+thisOne).style.color = textColour
		
		obj = document.all("ind"+thisOne).style.backgroundColor = thisColour

			
		}
		
	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 setHighlight(thisOne,thisColour)

{
//alert(textColour)
var obj

if (document.all)
		{
		
	//alert("IE")
		obj = document.all(thisOne).style.backgroundColor = thisColour
		
		
		}
		
	else if (document.getElementById)
		{
		//alert("netscapev6+")
		obj = document.getElementById(thisOne).style.backgroundColor = thisColour
		
		}
		
	else if (document.layers)
		{
		//alert("netscapev4")
		obj = ""
		}
		
}



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 directions(thisWidth,thisHeight)
{
//alert("here")
if(viewerScreen > 800)
{
finalWidth = parseInt(thisWidth)
finalWidth = finalWidth + 40
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 = "print_directions.asp"
//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 focusOnUser()
{
document.forms[0].name.focus()
}

function focusOnLogin(field)
{
//alert(field)
document.forms[0][field].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 checkProduct(thisOne)
{

if(parseInt(thisOne.Qty_Ordered.value) < 1)
	{
	alert("Please enter a qty of 1 or more.")
	thisOne.Qty_Ordered.focus()
	thisOne.Qty_Ordered.select()
    return (false);
	}
	
var checkOK = "123456789";
  var checkStr = thisOne.Qty_Ordered.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 \"Qty\" field.");
    thisOne.Qty_Ordered.focus()
	thisOne.Qty_Ordered.select()
    return (false);
  }

thisOne = parseInt(product.Format_Type.selectedIndex)

if(product.Format_Type.options[thisOne].value == "select")
  {
    alert("Please select a format suitable for the TV system in your country.\n\nIf you are unsure of which format you need please refer to the \"How To\"\nsection where you will find information on the different formats.");
    product.Format_Type.focus();
    return (false);
  }

}

function resetBackgroundDemo(thisOne,colour)

{
var obj

		if (document.all)
		{
		
	//alert("IE")
		obj = document.all(thisOne).style.backgroundColor = colour
		}
		
	else if (document.getElementById)
		{
		//alert("netscapev6+")
		obj = document.getElementById(thisOne).style.backgroundColor = colour
		}
		
	else if (document.layers)
		{
		//alert("netscapev4")
		obj = ""
		}
		
	
}


function setBackgroundDemo(thisOne,colour)

{

var obj

if (document.all)
		{
		
	//alert("IE")
		obj = document.all(thisOne).style.backgroundColor = colour
		}
		
	else if (document.getElementById)
		{
		//alert("netscapev6+")
		obj = document.getElementById(thisOne).style.backgroundColor = colour
		}
		
	else if (document.layers)
		{
		//alert("netscapev4")
		obj = ""
		}
		//obj.thisOne.style.backgroundColor = colour
	
}




function verify(enquiry)
{

  if(enquiry.Contact_Name.value == "")
  {
    alert("Please enter your name.");
    enquiry.Contact_Name.focus();
	//enquiry.bill_name.bgcolor == #FFFFFF
	enquiry.Contact_Name.select();
    return (false);
  }
  
  if(enquiry.Contact_Phone.value == "")
  {
    alert("Please enter a contact telephone number.");
    enquiry.Contact_Phone.focus();
	enquiry.Contact_Phone.select();
    return (false);
  } 
 
    var checkOK = "0123456789-+()#{}[] \t\r\n\f";
  var checkStr = enquiry.Contact_Phone.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("This field accepts only digits and the characters  + - ( ) # { } [ ] ");
    enquiry.Contact_Phone.focus()
	enquiry.Contact_Phone.select()
    return (false);
  }

 
   if(enquiry.Contact_eMail.value == "")
  {
    alert("Please enter an E-mail address where we can contact you.");
    enquiry.Contact_eMail.focus();
	enquiry.Contact_eMail.select()
    return (false);
  }
  
 

 
  	if(enquiry.Manufacturer.options[enquiry.Manufacturer.selectedIndex].value == "")
	{
	alert("Please select a manufacturer.");
    enquiry.Manufacturer.focus();
    return (false);
	}
	
	
	  	if(enquiry.Body.options[enquiry.Body.selectedIndex].value == "")
	{
	alert("Please select a preferred body style.");
    enquiry.Body.focus();
    return (false);
	}
	

return (true);

}



function setText(thisOne)

{
//alert("here")
	var obj

if (document.all)
		{
		
	//alert("IE")
		//obj = document.all("centre"+thisOne).style.backgroundColor = thisColour
		
		obj = document.all(thisOne).style.textDecoration = "underline"

		}
		
	else if (document.getElementById)
		{
		//alert("netscapev6+")
		//obj = document.getElementById("centre"+thisOne).style.backgroundColor = thisColour
		
		obj = document.getElementById(thisOne).style.textDecoration = "underline"
		}
		
	else if (document.layers)
		{
		//alert("netscapev4")
		obj = ""
		}

	
}


function resetText(thisOne)

{

	var obj

if (document.all)
		{
		
	//alert("IE")
		//obj = document.all("centre"+thisOne).style.backgroundColor = thisColour
		
		obj = document.all(thisOne).style.textDecoration = "none"

		}
		
	else if (document.getElementById)
		{
		//alert("netscapev6+")
		//obj = document.getElementById("centre"+thisOne).style.backgroundColor = thisColour
		
		obj = document.getElementById(thisOne).style.textDecoration = "none"
		}
		
	else if (document.layers)
		{
		//alert("netscapev4")
		obj = ""
		}

	
}

function showProduct(thisPage,thisWidth,thisHeight)
{
//alert(thisWidth)

finalWidth = parseInt(thisWidth)
finalWidth = finalWidth + 30
finalHeight = parseInt(thisHeight)
finalHeight = finalHeight + 40


leftAnchor = screenRes - (finalWidth / 2)
//alert(finalHeight)

var newWin = window.open("product_image.asp?id=" + thisPage + "","","status=no,toolbar=no,title=no,alwaysRaised=yes,location=no,scrollbars=no,resizable=no,left=" + leftAnchor + ", top=0")
//alert(newWin)
if(newWin!=null || newWin.closed)

{
newWin.window.resizeTo(finalWidth,finalHeight)
//newWin.window.resizeTo('800','800')
newWin.document.close()
}


}


function setText(thisOne)

{

	var obj

if (document.all)
		{
		
	//alert("IE")
		//obj = document.all("centre"+thisOne).style.backgroundColor = thisColour
		
		obj = document.all(thisOne).style.textDecoration = "underline"

		}
		
	else if (document.getElementById)
		{
		//alert("netscapev6+")
		//obj = document.getElementById("centre"+thisOne).style.backgroundColor = thisColour
		
		obj = document.getElementById(thisOne).style.textDecoration = "underline"
		}
		
	else if (document.layers)
		{
		//alert("netscapev4")
		obj = ""
		}

//alert("here")	
}


function resetText(thisOne)

{

	var obj

if (document.all)
		{
		
	//alert("IE")
		//obj = document.all("centre"+thisOne).style.backgroundColor = thisColour
		
		obj = document.all(thisOne).style.textDecoration = "none"

		}
		
	else if (document.getElementById)
		{
		//alert("netscapev6+")
		//obj = document.getElementById("centre"+thisOne).style.backgroundColor = thisColour
		
		obj = document.getElementById(thisOne).style.textDecoration = "none"
		}
		
	else if (document.layers)
		{
		//alert("netscapev4")
		obj = ""
		}

//alert("here")		
}



