// Functions for nr.com
$aboutData = Array;

function createRequestObject(){
	var request_o; 
	var browser = navigator.appName; 
	if(browser == "Microsoft Internet Explorer"){
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_o = new XMLHttpRequest();
	}
	return request_o; 
}
var http = createRequestObject(); 

function showHide (divId) { 
   whichDiv = document.getElementById(divId); 
   if (whichDiv.className=="divHidden") { 
      whichDiv.className="divShown";
   } 
   else { 
      whichDiv.className="divHidden";
   }  
} 

function highlight (divId) { 
   whichDiv = document.getElementById(divId); 
   if (whichDiv.className=="divHigh") { 
      whichDiv.className="divLow";
   } 
   else { 
      whichDiv.className="divHigh";
   }  
} 

function hide (divId) { 
   whichDiv = document.getElementById(divId);  
      whichDiv.className="divHidden";
} 

function show (divId) { 
   whichDiv = document.getElementById(divId);  
      whichDiv.className="divShown";
} 

$allow = true;

function handle($target, $cline){
	
		if($allow) {
			$allow = false;
			document.getElementById($target).innerHTML = 'working....';
			http.open('get', '../handle/?a='+$cline);
			http.onreadystatechange = function () {
				if(http.readyState == 4){
					var response = http.responseText;
					document.getElementById($target).innerHTML = response;
					//if($cline == "build") {
						//show('1');
					//}					
					$allow = true;
					
				}
			}
			http.send(null);
		}
		else {
			document.getElementById($target).innerHTML = "an error occured, please try again";;
		}
}
		
function about($what) {
	$tar = "aboutText";
	document.getElementById($tar).innerHTML = $aboutData[$what-1];
	
}

function service($what) {
	$tar = "serviceText";
	document.getElementById($tar).innerHTML = $serviceData[$what-1];
	
}

function sendForm() {
	if(contact_form.check()) {
		var rest = contact_form.values();
		handle('cfError', 'contact'+rest);
	}
	
}




	

