var i_toggle;
i_toggle = 0;

function input_toggle(loc){
	
	if(i_toggle == 0){
		document.getElementById('inputsection_'+loc).className='inputsection1';
		i_toggle = 1;

	} else {		
		if(document.getElementById('input_'+loc).value != ''){
		document.getElementById('inputsection_'+loc).className='inputsection2';
		} else {
		document.getElementById('inputsection_'+loc).className='inputsection';
		}
		
		i_toggle = 0;
	}
}


function confirmation(str, location) {
	var answer = confirm(str);
	if (answer){
		window.location = location;
	}
	
	return;
}


function pagereq(url, loc)
// pagereq loads a php file into a html element and passes url variables to it.
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=function(loc) {
	return function() {
	
	if (xmlHttp.readyState==1 || xmlHttp.readyState=="loading"){
		
		var newinnerhtml = document.getElementById(loc).innerHTML
		document.getElementById(loc).
	 	innerHTML="<p class=\"statusbox\"></p>"+newinnerhtml;
	}
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 	
	 document.getElementById(loc).
	 innerHTML=xmlHttp.responseText;
	}
	};
}(loc);
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function pagereqsjax(url, loc)
// pagereq loads a php file into a html element and passes url variables to it.
// SYNCHRONOUS VERSION!
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
url=url+"&sid="+Math.random()
xmlHttp.open("GET",url,false)
xmlHttp.send(null)
document.getElementById(loc).
innerHTML=xmlHttp.responseText;
} 


function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}



function target_classname (loc, varswitch) {
	document.getElementById(loc).className=varswitch
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}


// code courtesy of http://www.captain.at/howto-ajax-form-post-request.php
// who re-invents the wheel?

var http_request = false;

   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('formcontainer').innerHTML = result;
            setTimeout("parseScript(result)",50);

         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
   var poststr;
   

// script from http://www.ajaxlines.com/ajax/stuff/article/evaluate_scripts_while_working_on_ajax_requests.php

function parseScript(_source) {
  var source = _source;
  var scripts = new Array();
 
  // Strip out tags
  while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1) {
   var s = source.indexOf("<script");
   var s_e = source.indexOf(">", s);
   var e = source.indexOf("</script", s);
   var e_e = source.indexOf(">", e);
 
   // Add to scripts array
   scripts.push(source.substring(s_e+1, e));
   // Strip from source
   source = source.substring(0, s) + source.substring(e_e+1);
  }
 
  // Loop through every script collected and eval it
  for(var i=0; i<scripts.length; i++) {
   try {
    eval(scripts[i]);
   }
   catch(ex) {
    // do what you want here when a script fails
   }
  }
  // Return the cleaned source
  return source;
}

function get() {
}