// Pre-load rollover images

var preloaded = new Array();
function preload_images() 
{
   for (var i = 0; i < arguments.length; i++)
    {
        preloaded[i] = document.createElement('img');
        preloaded[i].setAttribute('src',arguments[i]);
    };
};

function preload_homepage()
{
	preload_images("/res/images/nav/pqla_hover.png","/res/images/nav/pqlb_hover.png","/res/images/nav/pqlc_hover.png");		
};

// --------------------------------------------
// Popup Download Request code
// --------------------------------------------

var newwindow;
function popupdownloadwindow(url)
{
	newwindow=window.open(url,'name','width=290,height=440,scrollbars0,status=0,toolbar=0,location=0,menubar=0,resizable=1');
	if (window.focus) {newwindow.focus()}
}

// --------------------------------------------
// Download File Stuff
// --------------------------------------------

function downloadFile()
{			
	// Validate form

	if 
	(
		(document.getElementById('txtName').value == '') ||
		(document.getElementById('txtEmail').value == '') ||
		(document.getElementById('txtCompanyName').value == '')
		
	)
	
	{
		alert('Please supply all details. Thank you.');
		return false;
	}
	// Do some DIV hiding/showing malarky

	document.getElementById('processingrequest').style.display = 'block';
	document.getElementById('popupcontent').style.display = 'none';
	var whichOne;
	var query = window.location.search.substring(1);
	var splitout = query.split('=');
	whichOne = splitout[1];		
	jellyfish.ajaxFunctions.downloadFile(whichOne,document.getElementById('txtName').value,document.getElementById('txtEmail').value,document.getElementById('txtCompanyName').value,downloadRequest_callback);
}

function downloadRequest_callback(res)
{			
	document.getElementById('closewindow').style.display= 'block';
	document.getElementById('manuallink').href=res.value;
	document.getElementById('processingrequest').style.display = 'none';
}	
