//search form

var d = window.document;

$(function(){
	var srchTxt = $(".search input:first");
	if(srchTxt.val() != ""){
		srchTxt.removeClass("noFocus");
	}
	$(".search input:first").blur(function(){
		var srchTxt = $(this);
		if(srchTxt.val() == ""){
			srchTxt.addClass("noFocus");
		}
	});

	$(".search input:first").focus(function(){
		var srchTxt = $(this);
		if(srchTxt.val() == ""){
			srchTxt.removeClass("noFocus");
		}
	});
	
	
	if(navigator.userAgent.indexOf('iPad') > -1){
		$("#pageTop").hide();
	}
});


// viewport
if(navigator.userAgent.indexOf('iPhone') > -1){
	location.replace('/mobile/'+location.pathname);
}else if(navigator.userAgent.indexOf('iPad') > -1){
	d.write('<meta name="viewport" content="width=1024" />');

}else if(navigator.userAgent.indexOf('Android') > -1){
	location.replace('/mobile/'+location.pathname);
}

//cookie
function changeView() {
    $.cookie("viewmode", "pc", { path: "/" });
}


// Google Analytics

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-25530187-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
