
 function getDataPost(dataSource,data,destid,load_image)
{

  var load_image = (load_image) ? load_image : "images/ajax-loader.gif";
try
 {
  var XMLHttpRequestObject='false'
if( window.XMLHttpRequest )  //browsers other than ie 5.5 - 6.0.
{
   XMLHttpRequestObject=new XMLHttpRequest()
}
else
	 {
      try
		 {
          XMLHttpRequestObject=new ActiveXObject( "Microsoft.XMLHTTP" )  
		 }
        catch(e)
		 {
           alert("Error:Browser:"+e);
		 }
	  }
}
catch(e)
      {
       alert("Error:0"+e);
	  }
	



  if(XMLHttpRequestObject){

  XMLHttpRequestObject.open("POST",dataSource);
  XMLHttpRequestObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  XMLHttpRequestObject.setRequestHeader('Content-length', data.length);
  
  XMLHttpRequestObject.onreadystatechange = function()
  {
     if (XMLHttpRequestObject.readyState == 1)
			 {  
			     if(destid == "popupbody")
				document.getElementById(destid).innerHTML ="<img src= './home_images/loading.gif'>";
				else
				document.getElementById(destid).innerHTML ="<img src= "+load_image+" />";
			} 
        
        if(XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200){
	
	  document.getElementById(destid).innerHTML= XMLHttpRequestObject.responseText;
         }
     } 		 
 }
   XMLHttpRequestObject.send("data =" +data);

}



//CLEARS A SPECIFIED FIELD - USED FOR onFocus//
function textClear(input){
	if ( input.value == input.defaultValue ) input.value = ""
}

//RESTORES A SPECIFIC FIELD TO IT'S DEFAULT - USED FOR onBlur//
function textRestore(input) {
	if ( input.value == "" ) input.value = input.defaultValue
}

function CheckInput(input,name,alt){
	//var input = eval("document." + input);
	if ( input.value == input.defaultValue ) input.value = "";
	if (Boolean(input)){
		//trim leading and trailing spaces//
		string = trim(input.value)
		var txt = (alt) ? alt : "Please provide the relevant information for this field.";
		if (isWhitespace(string)){
			 jAlert(name + " is empty \n----------\n" + txt);
			input.focus(); return false;
		}
		input.value = string
	} return true
}

//FORM VALIDATOR FUNCTIONS//
function isEmpty(s){ return ((s == null) || (s.length == 0)) }
function isWhitespace(s){
    var i;
    var whitespace = " \t\n\r";
	if (isEmpty(s)) return true;
	for (i = 0; i < s.length; i++){
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1) return false;
	} return true
}


//FUNCTIONS TO REMOVE LEADING AND TRAILING SPACES FROM A STRING USED IN CheckInput()
function ltrim(string){
	while (1){
		if (string.substring(0, 1) != " ") break;
		string = string.substring(1, string.length);
	}
	return string;
}
function rtrim(string){
	while (1){
		if (string.substring(string.length - 1, string.length) != " ") break;
		string = string.substring(0, string.length - 1);
	}
	return string;
}
function trim(string){
	var tmpstr = ltrim(string);
	return rtrim(tmpstr);
}


	function showtweecities()
	{
	  document.getElementById("tweecity_container").style.display ='';
	  document.getElementById("tweets_container").style.display ='none';
	}
	
	function showtweets()
	{
	  document.getElementById("tweecity_container").style.display ='none';
	  document.getElementById("tweets_container").style.display ='';
	  
	}
	





