// JavaScript Document

function checkpassword(){
	
	if(document.CONDORDealerAccessUsers.password.value != document.CONDORDealerAccessUsers.password2.value){
		document.CONDORDealerAccessUsers.password.value = 'Password does not match';
		document.CONDORDealerAccessUsers.password2.value = '';
		return false;
	}
	else
	{
		return true;
	}

}
		
function checkStateProvince()
{    
    if (document.CONDORQuote.state.value != '') 
	{
		  document.CONDORQuote.province.disabled = 'true';
		  document.CONDORQuote.province.Required = 'false';
			 //This section is for Firefox, DEP 13 Aug
			 if (document.CONDORQuote.province.getAttribute("Required") == "true")
			 {
				document.CONDORQuote.province.setAttribute('Required','false');
			 }
	}
	
	if (document.CONDORQuote.province.value != '')
	{
		document.CONDORQuote.state.disabled = 'true';
		document.CONDORQuote.state.Required = 'false';
			 if (document.CONDORQuote.state.getAttribute("Required") == "true")
			 {
				document.CONDORQuote.state.setAttribute('Required','false');
			 }
	}
}



/* AJAX FUNCTION */
function ajaxFunction(url,divid)
  {
  var xmlHttp;
 
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        document.getElementById(divid).innerHTML = xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }
  
  
  /* ADDED to to support dealers registration  DEPearson 20 Aug 2007 */
  /* Client-side access to querystring name=value pairs
	Version 1.2.3
	22 Jun 2005
	Adam Vandenberg
*/
function Querystring(qs) { // optionally pass a querystring to parse
	this.params = new Object()
	this.get=Querystring_get
	
	if (qs == null)
		qs=location.search.substring(1,location.search.length)

	if (qs.length == 0) return

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ')
	var args = qs.split('&') // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i=0;i<args.length;i++) {
		var value;
		var pair = args[i].split('=')
		var name = unescape(pair[0])

		if (pair.length == 2)
			value = unescape(pair[1])
		else
			value = name
		
		this.params[name] = value
	}
}

function Querystring_get(key, default_) {
	// This silly looking line changes UNDEFINED to NULL
	if (default_ == null) default_ = null;
	
	var value=this.params[key]
	if (value==null) value=default_;
	
	return value;
}


function getcookie(Name)
{
	if (document.cookie.length > 0)
	{
		
		begin = document.cookie.indexOf(Name+"=");
		if(begin != -1)
		{
			begin += Name.length+1;
			end = document.cookie.indexOf(";", begin);
			if(end == -1) {end = document.cookie.length;}
			var output = decodeURIComponent(document.cookie.substring(begin, end));
			//remove any special chars for spaces
			reg = /\+/g;
			output = output.replace(reg, ' ');
			return output;
			//return decodeURIComponent(document.cookie.substring(begin, end));
			//return document.cookie.substring(begin, end);
		}
	}
	return null;
}

