function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

//Ajax Search Dropdown Population
function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				req = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	function getState(countryId) {		
	//alert("findState.php?country="+countryId);	
		var strURL="findState.php?country="+countryId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('statediv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}

	function getStateClassifieds(countryId) {		
	//alert("findState.php?country="+countryId);	
		var strURL="findStateClassifieds.php?country="+countryId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('statediv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}

	function getCity(countryId,stateId) {
		//alert("am here");
		var strURL="findCity.php?country="+countryId+"&model="+stateId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('citydiv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
	}
//END Ajax Search Dropdown Population

//Ajax Select Auction Duration/Cost
function check(browser)
  {
	  var mySplitResult = browser.split("|");
	  document.getElementById("duration").value=mySplitResult[0];
	  document.getElementById("cost").value=mySplitResult[1];
	  document.getElementById('cal').style.display = 'none';

	  //alert(mySplitResult[0]);
	  if(mySplitResult[0] == "Enter Expiry Date"){
		document.getElementById('cal').style.display = 'block';
	  }
  }
//END Ajax Select Auction Duration/Cost

// Making #welcomeBox liquid
/*function welcomeBox() {
	if(!document.getElementById) return false;
	var wrapper = document.getElementById("wrapper");
	var welcomeBox = document.getElementById("welcomeBox");

	welcomeBox.setAttribute("id","welcomeBoxTopRight");
	
	var welcomeBoxTopLeft = document.createElement("div");
	welcomeBoxTopLeft.setAttribute("id","welcomeBoxTopLeft");
	wrapper.insertBefore(welcomeBoxTopLeft,welcomeBox);
	welcomeBoxTopLeft.appendChild(welcomeBox);
	
	var welcomeBoxTop = document.createElement("div");
	welcomeBoxTop.setAttribute("id","welcomeBoxTop");
	wrapper.insertBefore(welcomeBoxTop,welcomeBoxTopLeft);
	welcomeBoxTop.appendChild(welcomeBoxTopLeft);

	var welcomeBoxBot = document.createElement("div");
	welcomeBoxBot.setAttribute("id","welcomeBoxBot");
	wrapper.insertBefore(welcomeBoxBot,welcomeBoxTop);
	welcomeBoxBot.appendChild(welcomeBoxTop);


};


addLoadEvent(welcomeBox);*/