State = "";

var arImages=new Array();
function MM_preloadImages()
{
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function Change(button)
{
	switch (button)
	{
		case 0:
			frames('ViewScreen').focus()
			frames('ViewScreen').print()
		break
		
		case 1:
			window.open("TruckTag.asp",null,'resizable=yes,menubar=yes,scrollbars=yes,status=yes,width=800,height=600,left=0,top=0');
		break
		
		case 2:
			document.getElementById('ViewScreen').src = 'SUVTAG.asp'
			document.getElementById('FV').style.height = '250px'
		break
		
		case 3:
			document.getElementById('ViewScreen').src = 'Info_New.asp?execute=tellmemore'
			document.getElementById('FV').style.height = '250px'
		break
		
		case 4:
			document.getElementById('ViewScreen').src = 'DealerMap.asp'
			document.getElementById('FV').style.height = '360px'
		break
		
		case 5:
			window.open("TAG.asp",null,'resizable=yes,menubar=yes,scrollbars=yes,status=yes,width=800,height=600,left=0,top=0');
		break
		
		case 6:
			document.getElementById('ViewScreen').src = 'Company.asp'
			document.getElementById('FV').style.height = '360px'
		break
		
		case 7:
			document.getElementById('ViewScreen').src = 'TruckTagVideo1.html'
			document.getElementById('FV').style.height = '360px'
		break
		
		case 8:
			window.open("TheFifth.asp",null,'resizable=yes,menubar=yes,scrollbars=yes,status=yes,width=800,height=600,left=0,top=0');
		break
	}
}

function SetBookmark(Page)
{
	var source = document.getElementById('ViewScreen').src
	var pos = source.indexOf("#");
	if (pos < 0)
	{
		var adr = source;
	}
	else
	{
		var adr = source.substring(0,pos);
	}
	document.getElementById('ViewScreen').src = adr + Page;
}

function navRollOver(obj1, state)
{
  	var loc = window.location.pathname;
	var str = obj1;
	var pos = loc.indexOf(str);
	if (pos < 0)
	{
		document.getElementById(obj1).className = (state == 'on') ? 'nav-highlight' : 'nav';
	}
}

function stateRollOver(obj1, state)
{
  	var loc = window.location.pathname;
	var str = obj1;
	var pos = loc.indexOf(str);
	if (pos < 0)
	{
		document.getElementById(obj1).className = (state == 'on') ? 'state-highlight' : 'state-normal';
	}
}


function Navigate(page)
{
	var loc = window.location.pathname;
	var pos = loc.indexOf(page);
	var web = page.indexOf("http:")
	if (web < 0)
	{
		if (pos < 0)
		{
			window.location = page;
		}
	}
	else
	{
		window.open(page,null,'resizable=yes,scrollbars=yes,status=yes,width=800,height=600,left=0,top=0');
	}
}

function Nav_Opener(page)
{
	if (window.opener && !window.opener.closed)
	{
		window.opener.location=page
	}
}

function NewWindow(Page)
{
	window.open(Page,null,'resizable=yes,scrollbars=yes,status=yes,width=800,height=600,left=50,top=20');
}

function Window(Page)
{
	window.open('DealerArt/Dlr_State.asp?State='+Page,null,'resizable=yes,scrollbars=yes,status=yes,width=660,height=450,left=50,top=50');
}

function Gallery(Image,x,y)
{
	if (window.Tour)
	{
		window.Tour.close()
	}
	Tour = window.open('Images/'+Image,"Gallery",'resizable=yes,scrollbars=yes,status=yes,width='+x+',height='+y+',left=150,top=25',true);
}

function PressRelease(Release,Note)
{
	if (window.PR)
	{
		window.PR.close()
	}
	PR = window.open('PressRelease/PR.asp?Date=' + Release + '&Note=' + Note,null,'resizable=yes,scrollbars= yes,status=yes,width=800,height=500,left=0,top=25',true);
}

function checkMaxLength (textarea, evt, maxLength) 
{
  if (textarea.selected && evt.shiftKey) 
    // ignore shift click for select
    return true;
  var allowKey = false;
  if (textarea.selected && textarea.selectedLength > 0)
    allowKey = true;
  else 
  {
    var keyCode = 
      document.layers ? evt.which : evt.keyCode;
    if (keyCode < 32 && keyCode != 13)
      allowKey = true;
    else           
      allowKey = textarea.value.length < maxLength;
  }
  textarea.selected = false;
  return allowKey;
}

function storeSelection (field) 
{
  if (document.all) 
  {
    field.selected = true;
    field.selectedLength = 
      field.createTextRange ?
        document.selection.createRange().text.length : 1;
  }
}