/* -----------------------------------------------------------
	JavaScript JQfunctions_SC Ver0.0.4
	
	* Copyright : (C) SUNSCREATE
	* Description : JqConfig
	* Author : em
	* Author URI: http://www.sunscreate.com 
	
	Hello Guys!! (^o^)/
------------------------------------------------------------*/

$(function(){
	
// HoverImage_SC

	$("img.rov").mouseover(function(){
    $(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_rov$2"))
	}).mouseout(function(){
    $(this).attr("src",$(this).attr("src").replace(/^(.+)_rov(\.[a-z]+)$/, "$1$2"));
	}).each(function(){
    $("<img>").attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_rov$2"))
	});



// Browser Selector (Variable)

	var IE	=/*@cc_on!@*/false, //isMEIE
    Ope	= window.opera		//isOpera
	;


// Page Scroller  (#backto)

/*----------------------------------------------------------------------
	Jq Easing Function
	* jQuery Easing - http://gsgd.co.uk/sandbox/jquery/easing/
	* Open source under the BSD License.
	- Describing and copyright of the license have been lower side of the file.
	- Thanks for George McGinley Smith
----------------------------------------------------------------------*/

	jQuery.easing.quint = function (x, t, b, c, d) {
	//easeOutQuint
	return c*((t=t/d-1)*t*t*t*t + 1) + b;
	}; 

	$('p#backto, p.return').click(function(){

	if(Ope){
	$('html').animate({ scrollTop: 0 }, 800, 'quint'); return false;  //For Opera
	}
	else {
	$('html,body').animate({ scrollTop: 0 }, 800, 'quint'); return false;
	}

	});	


// CurrentPosition_SC #siteid
	$('body.home').each(function(){
		$('#siteid img').appendTo('#siteid').wrap('<span></span>');
		$('#siteid a').remove();
	});
	
// CurrentPosition_SC #gnav
	$('body.home').each(function(){
		$('#gnav li:nth-child(1) img').appendTo('#gnav li:nth-child(1)').wrap('<span></span>');
		$('#gnav li:nth-child(1) a').remove();
	});
	$('body.service').each(function(){
		$('#gnav li:nth-child(2) img').appendTo('#gnav li:nth-child(2)').wrap('<span></span>');
		$('#gnav li:nth-child(2) a').remove();
	});
	$('body.package').each(function(){
		$('#gnav li:nth-child(3) img').appendTo('#gnav li:nth-child(3)').wrap('<span></span>');
		$('#gnav li:nth-child(3) a').remove();
	});
	$('body.toolkits').each(function(){
		$('#gnav li:nth-child(4) img').appendTo('#gnav li:nth-child(4)').wrap('<span></span>');
		$('#gnav li:nth-child(4) a').remove();
	});
	$('body.about').each(function(){
		$('#gnav li:nth-child(5) img').appendTo('#gnav li:nth-child(5)').wrap('<span></span>');
		$('#gnav li:nth-child(5) a').remove();
	});
	$('body.contact').each(function(){
		$('#gnav li:nth-child(6) img').appendTo('#gnav li:nth-child(6)').wrap('<span></span>');
		$('#gnav li:nth-child(6) a').remove();
	});

	
// CurrentPosition_SC #gnav

	var pathName = window.location.pathname

	$('#localnav h2 a[href="' + pathName + '"]').each(function(){
	$('#localnav h2').addClass('current');
	});
	$('#localnav li a[href="' + pathName + '"]').each(function(){
	$(this).addClass("current");
	});

// stripetable
	$("table.stripe").each(function(){
		$(this).find("tr:even").addClass("odd");
		$(this).find("tr:odd").addClass("even");
	});
	
	// Form_SC
	/*$("input[@type=text]").addClass("text");
	$("input[@type=text], textarea").focus(function(){
		$(this).addClass("focus");
	});
	$("input[@type=text], textarea").blur(function(){
		if ($(this).find(".focus")) {
			$(this).removeClass("focus");
		}
	});*/

// MSieBlur_SC
	$(function () {
		if($.browser.msie) {
		addOnFocusAttribute();
		}
	});
	function addOnFocusAttribute() {
		$url = $('a[img]');
		$url.click(function () {
		this.blur();
		});
	};

//SwfObject
	$("#error404").each(function(){
	var so = new SWFObject("/error/404/error.swf", "notfound", "538", "50", "7", "#FFFFFF");
	so.write("error404");
	});


});



$(function(){
	$("#primary p, dl.colbox dd ,dl.check dd").css("text-justify","inter-ideograph");
});


$(function() {
	if(($.os.name == 'iphone')||($.os.name == 'ipad')){
		$("[href$='.swf']").attr("href","/demo/demo.mov");
	}
});




