//***************************************
function rogeeUSAautoSearchGETinv(str)
{
if (str=="")
  {
  document.getElementById("contentTarget").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("contentTarget").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","../_getInv.php?q="+str,true);
xmlhttp.send();

}


//***************************************
function rogTrimThis(rogString){
	return rogString.replace(/^\s+|\s+$/g, '');
}
	
function iAmLookingForSearch(iAct){
	var e = document.getElementById('rogeeSearchBox');
	if (iAct == 'on'){
		if(e.value == 'I am looking for ...'){
			e.value = '';
			e.style.color = '#ff0000';
			document.getElementById('trcMake').value = '';
			document.getElementById('trcModel').value = '';
			document.getElementById('trcYear').value = '';
			document.getElementById('rogeeSearchBoxButton').style.display = "block";
			document.getElementById('rogeeSearchBoxButton').style.visibility = "visible";
		}
	} else if (iAct == 'off'){
		var myBoxTrimmed = rogTrimThis(e.value);
		if(myBoxTrimmed.length == 0){
			e.value = 'I am looking for ...';
			e.style.color = '#666666';
			document.getElementById('rogeeSearchBoxButton').style.display = "none";
			document.getElementById('rogeeSearchBoxButton').style.visibility = "hidden";
		}	
	}
}
function iAmLookingForSearchVALIDATE(){
	var e = document.getElementById('rogeeSearchBox');
	var myBoxTrimmed = rogTrimThis(e.value);
	if(e.value == 'I am looking for ...' || myBoxTrimmed.length == 0){
		alert('Enter a search keyword.');
		e.value = 'I am looking for ...';
		e.style.color = '#666666';
		return false;
	}
}

//***************************************
function rogJavaDynamicLoadPhoto(f,n){
	var e = document.getElementById(f);
	if (e.style.display == 'block'){
		if (e.id == 'divPHOTOlargeView'){
			document.getElementById('ifrmPHOTO').src = n;
		}
	}
}

//***************************************
function rogeeusaASactionSelector(f){
	var e = document.getElementById(f);
	if (e.id == 'divDSVsearch_ACTION_WANT'){
		
		rogeeusaASHideMe('divDSVsearch_ACTION_COMMENTS');
		rogeeusaASHideMe('divDSVsearch_ACTION_RATE');
		rogeeusaASHideMe('divDSVsearch_ACTION_FRIENDS');
		rogeeusaASHidden(f);

	}else if (e.id == 'divDSVsearch_ACTION_COMMENTS'){

		rogeeusaASHideMe('divDSVsearch_ACTION_WANT');
		rogeeusaASHideMe('divDSVsearch_ACTION_RATE');
		rogeeusaASHideMe('divDSVsearch_ACTION_FRIENDS');
		rogeeusaASHidden(f);


	}else if (e.id == 'divDSVsearch_ACTION_RATE'){
		
		rogeeusaASHideMe('divDSVsearch_ACTION_WANT');
		rogeeusaASHideMe('divDSVsearch_ACTION_COMMENTS');
		rogeeusaASHideMe('divDSVsearch_ACTION_FRIENDS');
		rogeeusaASHidden(f);

	}else if (e.id == 'divDSVsearch_ACTION_FRIENDS'){

		rogeeusaASHideMe('divDSVsearch_ACTION_WANT');
		rogeeusaASHideMe('divDSVsearch_ACTION_COMMENTS');
		rogeeusaASHideMe('divDSVsearch_ACTION_RATE');
		rogeeusaASHidden(f);
	}
}

//***************************************
function rogeeusaASHidden(eID){
	var e = document.getElementById(eID);
	if(	e.style.display		== "block"){
		e.style.display		= "none";
		e.style.visibility	= "hidden";
	}else{
		e.style.display		= "block";
		e.style.visibility	= "visible";
	}
}
function rogeeusaASVisible(eID){
	var e = document.getElementById(eID);
	if(	e.style.display		== "none"){
		e.style.display		= "block";
		e.style.visibility	= "visible";
	}else{
		e.style.display		= "none";
		e.style.visibility	= "hidden";
	}
}
function rogeeusaASShowMe(eID){
	var e = document.getElementById(eID);
	e.style.display		= "block";
	e.style.visibility	= "visible";
}
function rogeeusaASHideMe(eID){
	var e = document.getElementById(eID);
	e.style.display		= "none";
	e.style.visibility	= "hidden";
}


//***************************************
function rogBoxShowMe(lightID, fadeID){
	document.getElementById(lightID).style.display='block';
	document.getElementById(fadeID).style.display='block';
}
function rogBoxHideMe(lightID, fadeID){
	document.getElementById(lightID).style.display='none';
	document.getElementById(fadeID).style.display='none';
}


//***************************************
function PoweredByDealerSERVE640x480(url){
	rbiWin1 = window.open(url,'DealerSERVEPoweredBy','WIDTH=640,height=480,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=10,top=10');
	rbiWin1.focus();
}

function RogeeusaAS400x300(url){
	rbiWin1 = window.open(url,'RogeeusaAS400','WIDTH=400,height=300,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=0,top=0');
	rbiWin1.focus();
}

function RogeeusaAS640x480(url){
	rbiWin2 = window.open(url,'RogeeusaAS650','WIDTH=640,height=480,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=0,top=0');
	rbiWin2.focus();
}

function RogeeusaAS680x520(url){
	rbiWin2 = window.open(url,'RogeeusaAS680','WIDTH=680,height=520,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=0,top=0');
	rbiWin2.focus();
}

function RogeeusaAS800x640(url) {
	rbiWin3 = window.open(url,"RogeeusaAS800","WIDTH=800,height=640,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=1,status=1,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=0,top=0");
	rbiWin3.focus();
}

function RogeeBI800x640(url) {
	rbiWin3 = window.open(url,"RogeeBI800","WIDTH=800,height=640,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=1,status=1,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=0,top=0");
	rbiWin3.focus();
}

function RogeeusaAS980x720(url) {
	rbiWin4 = window.open(url,"RogeeusaAS980","WIDTH=980,height=720,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=1,status=1,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=0,top=0");
	rbiWin4.focus();
}

function RogeeusaAS1028x768(url) {
	rbiWin4 = window.open(url,"RogeeusaAS1028","WIDTH=1028,height=768,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=1,status=1,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=0,top=0");
	rbiWin4.focus();
}

function SiteDeparture(url) {
	rbiWin4 = window.open(url,"SiteDepartureRogeeusaAS","WIDTH=900,height=700,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=1,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=0,top=0");
	rbiWin4.focus();
}

function usaAStrcNew(url) {
	myWdw = window.open(url,"rogWind","WIDTH=782,height=540,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=1,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=1,z-lock=0,screenX=0,screeny=0,left=0,top=0");
	myWdw.focus();
}

function RogeeusaASreport700x620(url){
	rbiWin2 = window.open(url,'RogeeusaASreport700','WIDTH=700,height=620,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=10,top=10');
	rbiWin2.focus();
}

function RogeeusaASvideo440x440(url){
	rbiWin2 = window.open(url,'RogeeusaASreport440','WIDTH=440,height=440,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=10,top=10');
	rbiWin2.focus();
}

//***************************************
var please_wait = null;
function open_url(url, target) {
 	if ( ! document.getElementById) {
  		return false;
 	}
 	if (please_wait != null) {
  		document.getElementById(target).innerHTML = please_wait;
 	}
 	if (window.ActiveXObject) {
  		link = new ActiveXObject("Microsoft.XMLHTTP");
 	} else if (window.XMLHttpRequest) {
  		link = new XMLHttpRequest();
 	}
 	if (link == undefined) {
  		return false;
 	}
 	link.onreadystatechange = function() { response(url, target); }
 	link.open("GET", url, true);
 	link.send(null);
}
function response(url, target) {
 	if (link.readyState == 4) {
	 	document.getElementById(target).innerHTML = (link.status == 200) ? link.responseText : "<b>KoooDooo Alert:</b><br>-Content Pending.<br>-Error Number " + link.status;
	}
}
function set_loading_message(msg) {
 	please_wait = msg;
}
//***************************************
function open_url1(url,target,str1){
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById(target).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET",url+"?str1="+str1, true);
	xmlhttp.send();
}
//***************************************
function open_url2(url,target,str1,str2){
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById(target).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET",url+"?str1="+str1+"&str2="+str2, true);
	xmlhttp.send();
}
//***************************************
function open_url3(url,target,str1,str2,str3){
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById(target).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET",url+"?str1="+str1+"&str2="+str2+"&str3="+str3, true);
	xmlhttp.send();
}
//***************************************
function open_url4(url,target,str1,str2,str3,str4){
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById(target).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET",url+"?str1="+str1+"&str2="+str2+"&str3="+str3+"&str4="+str4, true);
	xmlhttp.send();
}

//***************************************
function rogNavSwap(i_zImgName, i_zImgNewSrc){
	if (document.images){
		document.images[i_zImgName].src = i_zImgNewSrc;
	}
}
//***************************************
function open_url1(url,target,str1){
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById(target).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET",url+"?str1="+str1, true);
	xmlhttp.send();
}
//***************************************
function open_url2(url,target,str1,str2){
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById(target).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET",url+"?str1="+str1+"&str2="+str2, true);
	xmlhttp.send();
}
//***************************************
function open_url3(url,target,str1,str2,str3){
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById(target).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET",url+"?str1="+str1+"&str2="+str2+"&str3="+str3, true);
	xmlhttp.send();
}
//***************************************
function open_url4(url,target,str1,str2,str3,str4){
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById(target).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET",url+"?str1="+str1+"&str2="+str2+"&str3="+str3+"&str4="+str4, true);
	xmlhttp.send();
}
//***************************************
var oldClass;
function switchClass(classObj, newClass) {
  if( newClass ) {
    oldClass = classObj.className;
    classObj.className = newClass;
  } else {
    classObj.className = oldClass;
  }
}

//***************************************
function usaAS_ChangeColor(tableRow, highLight){
	if (highLight) {
		tableRow.style.backgroundColor = '#dddddd';
		tableRow.style.cursor = 'hand';
		
	}else{
		tableRow.style.backgroundColor = '#ffffff';
		tableRow.style.cursor = 'pointer';
	}
}
function usaAS_DoNav(theUrl) {
	document.location.href = theUrl;
}

//******************************************************************************

function validateForm_usaAS(f) {
	if (f.Customer_FIRST_NAME.value.length < 2){
		alert('First and Last Names required. Please enter your First Name.');
		f.Customer_FIRST_NAME.focus();
		return false;
	}
	if (f.Customer_LAST_NAME.value.length < 2){
		alert('First and Last Names required. Please enter your Last Name.');
		f.Customer_LAST_NAME.focus();
		return false;
	}
	if (f.Customer_TELEPHONE_DAY.value.length < 10){
		alert('Telephone and Email required. Please enter your Telephone including Area Code.');
		f.Customer_TELEPHONE_DAY.focus();
		return false;
	}
	if (f.Customer_EMAIL.value.search('@') == -1 || f.Customer_EMAIL.value.search('[.*]') == -1){
		alert('Telephone and Email required. Please enter your valid Email Address.');
		f.Customer_EMAIL.focus();
		return false;
	}
	if (f.Customer_ZIP.value.length < 5){
		alert('Please enter your Zip Code.');
		f.Customer_ZIP.focus();
		return false;
	}
	if (f.Customer_COMMENTS.value.length < 4){
		alert('What if your message for this dealer. Include additional instructions or anything you would like this dealer to know that would help you get this vehicle.');
		f.Customer_COMMENTS.focus();
		return false;
	}
}

function ValidateCommentsForm(f) {
	if (f.Comment_Message.value.length < 5){
		alert('Enter your comments. At minimum, 5 characters are required.');
		f.Comment_Message.focus();
		return false;
	}
	if (f.rhvc.value.length < 8){
		alert('r-Human Validator Code');
		f.rhvc.focus();
		return false;
	}
	if (f.Comment_Private.value.length < 1){
		alert('Select PRIVATE or PUBLIC comment.');
		f.Comment_Private.focus();
		return false;
	}
}

function ValidateRatedDealer(f) {
	if (f.Rated_Question1.value.length < 1){
		alert('Question 1?');
		f.Rated_Question1.focus();
		return false;
	}
	if (f.Rated_Question2.value.length < 1){
		alert('Question 2?');
		f.Rated_Question2.focus();
		return false;
	}
	if (f.Rated_Question3.value.length < 1){
		alert('Question 3?');
		f.Rated_Question3.focus();
		return false;
	}
	if (f.Rated_Question4.value.length < 1){
		alert('Question 4?');
		f.Rated_Question4.focus();
		return false;
	}	
	if (f.Rated_Question5.value.length < 1){
		alert('Question 5?');
		f.Rated_Question5.focus();
		return false;
	}
}

//***************************************
function rogScreenNameCheck_AJAX(url, txtbox, msgbox, fname, lname, uname, zcode){
	var x = document.getElementById(txtbox);
	var xv = document.getElementById(txtbox).value;
	var m = document.getElementById(msgbox);
	var f = document.getElementById(fname).value;
	var l = document.getElementById(lname).value;
	var u = document.getElementById(uname).value;
	var z = document.getElementById(zcode).value;

if (url.length==0){
	document.getElementById(msgbox).innerHTML="";
	return;
}
if (window.XMLHttpRequest){
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
}else{
	// code for IE6, IE5
  	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
	if (xmlhttp.readyState==4 && xmlhttp.status==200){
		document.getElementById(msgbox).innerHTML=xmlhttp.responseText;
	}
}
xmlhttp.open("GET",url+"?x="+txtbox+"&xv="+xv+"&m="+msgbox+"&f="+f+"&l="+l+"&u="+u+"&z="+z, true);
xmlhttp.send();
}
