// JavaScript Document


function jump(form) { 
location.href="" + form.options[form.selectedIndex].value
}

function showlayer(layer){
var myLayer = document.getElementById(layer).style.display;
if(myLayer=="none"){
document.getElementById(layer).style.display="block";
} else {
document.getElementById(layer).style.display="none";
}
}

//Carousel
jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel();
});

//Carousel
jQuery(document).ready(function() {
    jQuery('#mygallerycarousel').jcarousel();
});

function initImage() {
	imageId = 'photo';
	image = document.getElementById(imageId);
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,0);
}
function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
		}
	}
}
function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

//Browser Support Code
function getImage(id){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	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(){
	
	if(ajaxRequest.readyState == 4){
		var ajaxDisplay = document.getElementById('ajaxImg');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			initImage()
			var x = ajaxDisplay.getElementsByTagName("script");   
			for(var i=0;i<x.length;i++)  
			{  
				eval(x[i].text);  
			}  
	}
}


var queryString = "?id=" + id;
ajaxRequest.open("GET", "http://www.typhoon-int.co.uk/_ajax/get_image.php" + queryString, true);
ajaxRequest.send(null);  
    
}


function resources(rid) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open('http://resources.typhoon-int.co.uk/downloads/?id="+rid+"', '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400');");
}
