//If user is using iPhone or iPod Touch;
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
{
	window.location = "http://www.hex.sg/iphone";
}

//bypass internet explorer bug
function noError(){return true;}
window.onerror = noError;

//Flash
function loadFlash(val)
{
	var project = {
	  proj: val
	};
	
	$(document).ready(function(){
	  $('#showcase_body').flash(
	    {
	      src: 'http://www.hex.sg/work.swf',
	      flashvars: project,
	      width: 546,
	      height: 369,
	      id:"work"
	    },
	    {
	      version: '9.0.0'
	    }
	  );
	});
}

jQuery(function($){
	
	var window_delay = 1000;
	var panel_delay = 800;
	
	//Scroll To Top (global)
	$('#btn_top').localScroll({
		duration:window_delay,
		easing: 'easeInOutExpo',
		lazy:true
	});
	
	//Scroll (about panels)
	$('#about_btns').localScroll({
		target: '#about',
		easing: 'easeInOutExpo',
		duration:panel_delay,
		lazy:true	
	});
	
	//Scroll (contact panels)
	$('#contact_btns').localScroll({
		target: '#contact',
		easing: 'easeInOutExpo',
		duration:panel_delay,
		lazy:true	
	});
	
});

//News Slider
jQuery(window).bind("load", function() {
	jQuery("div#slider1").codaSlider()
});
	
$.fn.clearForm = function() 
{
	return this.each(function() 
	{
		var type = this.type, tag = this.tagName.toLowerCase();
		if (tag == 'form')
		  return $(':input',this).clearForm();
		if (type == 'text' || type == 'password' || tag == 'textarea')
		  this.value = '';
		else if (type == 'checkbox' || type == 'radio')
		  this.checked = false;
		else if (tag == 'select')
		  this.selectedIndex = -1;
	});
};

//email
function em(){
	//<![CDATA[			
eval(unescape('%76%61%72%20%73%3D%27%61%6D%6C%69%6F%74%69%3A%66%6E%40%6F%65%68%2E%78%67%73%27%3B%76%61%72%20%72%3D%27%27%3B%66%6F%72%28%76%61%72%20%69%3D%30%3B%69%3C%73%2E%6C%65%6E%67%74%68%3B%69%2B%2B%2C%69%2B%2B%29%7B%72%3D%72%2B%73%2E%73%75%62%73%74%72%69%6E%67%28%69%2B%31%2C%69%2B%32%29%2B%73%2E%73%75%62%73%74%72%69%6E%67%28%69%2C%69%2B%31%29%7D%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%28%27%3C%61%20%68%72%65%66%3D%22%27%2B%72%2B%27%22%3E%69%6E%66%6F%40%68%65%78%2E%73%67%3C%2F%61%3E%27%29%3B'))
//]]>
}

/*
//ClickHeat (heat maps code)
clickHeatSite = 'Hex';
clickHeatGroup = (document.title == '' ? '-none-' : encodeURIComponent(document.title));
clickHeatServer = 'http://hex.sg/heatmap/click.php';
initClickHeat();
*/