<!--//
// IF YOU SEE THIS UPGRADE YOUR BROWSER !!!
//////////////////////////////////////////////////////////////////////////////////////
//// Hampton Development  -  http://www.hamptondevelopment.us            
//// Commercial Web Site Development & Web Site Hosting                                                       
//// Custom Scripting, Applications & Graphics - Absolutely No Redistribution 
//// Copyright © 1996 - 2009 Hampton Development  All Rights Reserved.                                                   
//////////////////////////////////////////////////////////////////////////////////////
//
// Copyright Script - Alert Message Disabled By Default

defaultStatus="A.R.E. Truck Caps & Tonneau Covers :: 4ARE.com"

// var clickmessage="Sorry, no right click over images."

/*

var clickmessage="Sorry, No Right Click Over Images.\nRight Click Menu Is Disabled ONLY Over Copyright Protected Images.\nCopyright © A.R.E., Inc. - All Rights Reserved." 

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false;
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()

*/

///////////////////////////////////////////////////////////////////////////

// Hides Javascript Error Status
window.onerror=new Function("return true;");

// Disable text selecting and copy-paste functions.
// document.onselectstart=new Function("return false;");

// Disable drag & drop
// document.ondragstart=new Function("return false;");

// Disables showing URL of links in status bar. Overides All Set Messages To Default
// document.onmousemove=new Function("window.status='';");

///////////////////////////////////////////////////////////////////////////	
// activateActiveX - fixes click certain types of elements to activate before use.

if (navigator.appName == "Microsoft Internet Explorer") {
	
	//Array of elements to be replaced
	var arrElements = new Array(3);
	arrElements[0] = "object";
	arrElements[1] = "embed";
	arrElements[2] = "applet";
	
	//Loop over element types
	for (n = 0; n < arrElements.length; n++) {
	
		//set object for brevity
		replaceObj = document.getElementsByTagName(arrElements[n]);
		
		//loop over element objects returned
		for (i = 0; i < replaceObj.length; i++ ) {
		
			//set parent object for brevity
			parentObj = replaceObj[i].parentNode;
			
			//grab the html inside of the element before removing it from the DOM
			newHTML = parentObj.innerHTML;
			
			//remove element from the DOM
			parentObj.removeChild(replaceObj[i]);
			
			//stick the element right back in, but as a new object
			parentObj.innerHTML = newHTML;
		
			}
		}
	}

///////////////////////////////////////////////////////////////////////////	
// Form Submit Once /////

function submitonce(theform){
if (document.all||document.getElementById){
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
tempobj.disabled=true
}
}
}

///////////////////////////////////////////////////////////////////////////	
// Open Window /////

function resizeWin(newLoc, newWidth, newHeight) {
        newWin = open("",newLoc,"scrollbars=yes,margin=0,resizable=no,status=no,height=" + newHeight + ",width=" + newWidth);
}	

///////////////////////////////////////////////////////////////////////////
function change_img() {
current = document.ch_form.ch_img.selectedIndex;
document.images.ch_show.src = document.ch_form.ch_img[current].value;
}

///////////////////////////////////////////////////////////////////////////	
//// Show / Hide Layers ////

function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null)
{ v=args[i+2];
if (obj.style) { obj=obj.style;
v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }
}

function showLayer(layerName, shoLayerName)
{
if (document.getElementById) // Netscape 6 and IE 5+
{
var targetElement = document.getElementById(layerName);
var shadowElement = document.getElementById(shoLayerName);
targetElement.style.top = shadowElement.style.top;
targetElement.style.visibility = 'visible';
}
}

function hideLayer(layerName)
{
if (document.getElementById) 
{
var targetElement = document.getElementById(layerName);
targetElement.style.visibility = 'hidden';
}
}

///////////////////////////////////////////////////////////////////////////	
//// Text Tips ////

function getLayer(SRC){
	var tDIV = document.getElementById(SRC)             
             tDIV.style.cursor = "hand"
	tDIV.style.visibility = "visible"
}
function floatLayer(SRC){
	var tDIV = document.getElementById(SRC)
             tDIV.style.top = window.event.clientY + 20
	if(window.event.clientX+200>document.body.clientWidth)
	{
		tDIV.style.left = document.body.clientWidth - 200
	}
	else
	{
		tDIV.style.left = window.event.clientX// + 15
	}
}	
function hideLayer(SRC){
	var tDIV = document.getElementById(SRC)
             tDIV.style.visibility='hidden'
}

// Hide all select boxes    
function hideSelect()
{
    if (document.all) // Only do this for IE
    {
        for (formIdx=0; formIdx<document.forms.length; formIdx++) 
        {
            var theForm = document.forms[formIdx];
            for(elementIdx=0; elementIdx<theForm.elements.length; elementIdx++)
            {
                window.status += theForm[elementIdx].type;
                if(theForm[elementIdx].type == "select-one") 
                {    theForm[elementIdx].style.visibility = "hidden";    }
            }
        }
    }
}

// Unhide all select boxes
function unhideSelect()
{
    if (document.all) // Only do this for IE
    {
        for (formIdx=0; formIdx<document.forms.length; formIdx++) 
        {
            var theForm = document.forms[formIdx];
            for(elementIdx=0; elementIdx<theForm.elements.length; elementIdx++)
            {
                if(theForm[elementIdx].type == "select-one") 
                {    theForm[elementIdx].style.visibility = "visible";    }
            }
        }
    } 
}


//// Email Validation /////////////////////////////////////////////

var chkDot = true;
var usEmail = true;
function validEmail(eAddr) 
{ 
   var lenSuffix = (usEmail) ? 3: 1;
   var goodAddr = false;
   var ndxAt = ndxDot = 0;

   ndxAt  = eAddr.indexOf("@");
   ndxDot = eAddr.indexOf(".");
   ndxDot2 = eAddr.lastIndexOf(".");

   if ( (ndxDot < 0) || (ndxAt < 0) )
      alert("Your email address lacks '.' or '@'.\n\nThe format is 'MyEmail@SomeDomain.suf'");  
   else if (chkDot  && (ndxDot < ndxAt) )
        chkDot =!( confirm("You entered a 'dot' before the '@'\n Are you sure that is right?"));
   else if ( (ndxDot2 - 1) <= ndxAt)
        alert("You may be missing your domain name.\n\nThe format is 'MyEmail@SomeDomain.suf'");
   
   else if ( eAddr.length < (ndxDot2 + lenSuffix) )
      usEmail =!( confirm("You have fewer than 2 characters as a domain suffix.\nAre you sure that is right?"));
   else
      goodAddr = true;
   
   return (goodAddr);                       
}

///////////////////////////////////////////////////////////////////////////							
//-->

