// COLORBOX for GA Printing PQCOS System
// For floating lightbox pages
// 07082010

$(document).ready(function(){				
	$(".download_ds").colorbox({width:"37%", inline:true, href:"#inline_requestform"});	
	$(".readmore_news").colorbox({width:"50%", inline:true, href:"#inline_readmorenews"});	
	$(".readmore_services").colorbox({width:"50%", inline:true, href:"#inline_readmoreservices"});	
	$(".validate_action_now").colorbox({width:"37%", inline:true, href:"#inline_validate_action"});	
	//Example of preserving a JavaScript event for inline calls.
	$("#click").click(function(){ 
		$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
		return false;
	});
});

function datasheetRequest(result_container,on_process_container, datasheet, datasheetid){
		
		var ajaxRequest;  // The variable that makes Ajax possible!	
		var name = document.getElementById('txt_name').value;
		var company = document.getElementById('txt_com').value;
		var industry = document.getElementById('txt_ind').value;
		var position = document.getElementById('txt_pos').value;
		var email = document.getElementById('txt_email').value;
	//alert(jobspec_id);	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	
// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		showOnProcess(on_process_container);
		hideOnProcess(result_container);		
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById(result_container);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			hideOnProcess(on_process_container);
			showOnProcess(result_container);			
		}
	}	
	
	var queryString = "?datasheet="+datasheet+"&name="+name+"&company="+company+"&industry="+industry+"&position="+position+"&email="+email+"&datasheetid="+datasheetid;
	//alert(queryString);
	ajaxRequest.open("GET","datasheet_request.php" + queryString, true);
	ajaxRequest.send(null);	
	
}



function showOnProcess(on_process_container)
{
	document.getElementById(on_process_container).style.display = "block";
}

function hideOnProcess(on_process_container)
{
	document.getElementById(on_process_container).style.display = "none";	
}
