
function setDiv() {
  var wh = getWindowHeight(); // Window Height
  var d = document.getElementById('container') // Get div element  
  var dh = d.offsetHeight // div height
  if (dh < wh) {
//	  alert (dh);
	  d.style.height = wh + 'px'; // Set div height to window height
  }
}

function getWindowHeight() {
  var windowHeight = 0;
	
  if (typeof(window.innerHeight) == 'number')
    windowHeight = window.innerHeight;
	
  else {
		
    if (document.documentElement && document.documentElement.clientHeight)
      windowHeight = document.documentElement.clientHeight;
		
    else {
      if (document.body && document.body.clientHeight)
        windowHeight = document.body.clientHeight; }; };
				
  return windowHeight;
};

function defaultFormValues (type)
{
	if (type == "username")
	{
		//var loginUsername = document.getElementById("loginUsername").value;
		var loginUsername = document.getElementById("loginUsername");

		if (loginUsername.value == "twitter username")
		{
			loginUsername.value = "";
		}
		else if (loginUsername.value == "")
		{
			loginUsername.value = "twitter username";		
		}			
	}
	else if (type == "password")
	{
		//var loginPassword = document.getElementById("loginPassword").value;
		var loginPassword = document.getElementById("loginPassword");		
		
		if (loginPassword.value == "twitter password")
		{
			loginPassword.value = "";
			loginPassword.type = "password";
			//document.getElementById("loginPassword").value = "";
			//document.getElementById("loginPassword").type = "password";
		}
		else if (loginPassword.value == "")
		{
			loginPassword.value = "twitter password";
			loginPassword.type = "text";
			//document.getElementById("loginPassword").value = "twitter password";
			//document.getElementById("loginPassword").type = "text";			
		}
	}
}
								
   
   function createRequest() {
	 var request = null;
     try {
       request = new XMLHttpRequest();
     } catch (trymicrosoft) {
       try {
         request = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (othermicrosoft) {
         try {
           request = new ActiveXObject("Microsoft.XMLHTTP");
         } catch (failed) {
           request = null;
         }
       }
     }

     if (request == null) {alert("There was an Error, please try again");} 
	 else {return request;} 
} // Construct AJAX Object

function getURLVar(urlVarName) {

/** Retrieve using the following snipped as an example **

var updateType = getURLVar('updateType');
if (updateType == "manual")
{
	getPHPData ();
}
***/

//divide the URL in half at the '?'
var urlHalves = String(document.location).split('?');
var urlVarValue = '';
	if(urlHalves[1]){
	//load all the name/value pairs into an array
	var urlVars = urlHalves[1].split('&');
	//loop over the list, and find the specified url variable
		for(i=0; i<=(urlVars.length); i++){
			if(urlVars[i]){
			//load the name/value pair into an array
			var urlVarPair = urlVars[i].split('=');
				if (urlVarPair[0] && urlVarPair[0] == urlVarName) {
				//I found a variable that matches, load it's value into the return variable
				urlVarValue = urlVarPair[1];
				}
			}
		}
}

return urlVarValue;   
} // Retrieve GET variables

