$.app_root = '/';

$(function(){
	
	if ($.browser.msie) {
		$.ie_ver = Math.floor(parseFloat($.browser.version));
	}
	
	//APPLY IE6 TRANSPARENCY FIX TO ALL PNG IMAGES THAT HAVE CLASS PNG
	if ($.ie_ver && $.ie_ver == 6) $IE6_PNG_Fix();
	
	//ADD BEHAVIOR TO SEARCH LINKS
	$('a.search').click(function(){alert('Search feature coming soon.');});
	
	//ADD BEHAVIOR TO ELEMENTS WITH AUTOFILL CLASS
	//$('.autofill').each(function(){
	//	$(this)
	//	.val($(this).attr('fill')).addClass('empty')
	//	.bind('focus',function(){
	//		if ($(this).val() == $(this).attr('fill')) $(this).val('').removeClass('empty');
	//	})
	//	.bind('blur',function(){
	//		if ($(this).val() == '') $(this).val($(this).attr('fill')).addClass('empty');
	//	});
	//});
	
	//ADD BEHAVIOR TO ELEMENTS WITH HOVER CLASS
	$('.hover').hover(function(){$(this).addClass('over')},function(){$(this).removeClass('over')});
	
	//MODAL SIGNUP
	if (window.JS_ShowDialog_Signup)
	$('a.signup').click(JS_ShowDialog_Signup);
	
	if (!$.ie_ver || $.ie_ver > 6) {
		$("#page-icon a").tipTip({delay:150});
	}
	
	$('#page-feat .feat').blinds(9000);
	
	var page_name = window.location.pathname.replace(/^\//,'');
	var hnav = {
		'about':{
			'our-team':'Our Team',
			'how-we-work':'How We Work',
			'why-sigate':'Why Sigate?',
			'guarantee':'Our Guarantee'
		},
		'solutions':{
			'our-team':'Our Team',
			'how-we-work':'How We Work',
			'why-sigate':'Why Sigate?',
			'guarantee':'Our Guarantee'
		},
		'resources':{
			'faq':'Q&A\'s',
			'free-downloads-resources':'Free Apps',
			'tips-tricks':'Tips & Tricks',
			'affiliates':'Affiliates'
		},
		'services':{
			'websites':'Website Creation',
			'flowmail-email-marketing':'Email Marketing',
			'search-engine-optimization-marketing':'Online Marketing',
			'web-hosting':'Hosting'
		},
		'contact':{
			'request-quote':'Get a Quote',
			'contact':'Email Us',
			'request-callback':'Request Callback',
			'face-to-face':'Face to Face'
		}
	};
	if (hnav[page_name]) {
		//fix horizontal nav
	}
	
	$('.page-portfolio #flash-gallery').each(function(){
		var flashvars = {
			xml:"/dynamic/portfolio/cu3er.xml",
			font:"font.swf"
		};
		var attributes = {
			wmode:"transparent",
			id:"slider"
		};
		swfobject.embedSWF("/assets/portfolio/cu3er.swf", "flash-gallery", "600", "360", "9", "expressInstall.swf", flashvars, attributes);
	});
	
});

function $IE6_PNG_Fix() {
	$('.png').each(function(){
		var i1 = this, i2 = new Image();
		i2.onload = function(){
			var int_w = i2.width, int_h = i2.height;
			i1.onload = function(){
				this.onload = null;
				$(this).css({'width':int_w + 'px','height':int_h + 'px','display':'block','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + i2.src + "', sizingMethod='scale')"});
			};
			i1.src = $.app_root + 'images/invis.gif';
		};
		i2.src = i1.src;
	});
}


