// JavaScript Document

function DropMenu_Interface(){
	/* -------------------------------------------------------------------------------------------------------------------------- */
	/* NAVIGATION */
	/* -------------------------------------------------------------------------------------------------------------------------- */
	$("#page_navigation li div a").click(function(){
		$('#page_navigation li div').removeClass('selected');
		$(this).parent().addClass('selected');
	});
	/* -------------------------------------------------------------------------------------------------------------------------- */
	/* SELECT BOXES */
	/* -------------------------------------------------------------------------------------------------------------------------- */
	
	
	// -> Work by Product
	$(".search-pulldown-1").hover( function() {
		$(this).css({"cursor":"pointer"});	
		$(this).addClass("pullactive");
		if ( $.browser.msie ) {
  			$('#pull-work').css({"top":73,"left":37}).show();
		} else {
			$('#pull-work').css({"top":73,"left":37}).fadeIn();
		}
		
 	}, function(){
		$('#pull-work').hide();
		$('.search-pulldown-1').removeClass("pullactive");
	});
	
	$('#pull-work').hover(function(){
		$('.search-pulldown-1').css({"cursor":""});
	});
	// -> Work by Client
	$(".search-pulldown-2").hover( function() {
		$(this).css({"cursor":"pointer"});	
		$(this).addClass("pullactive");
		if ( $.browser.msie ) {
			$('#pull-client').css({"top":73,"left":268}).show();
		} else {
			$('#pull-client').css({"top":73,"left":268}).fadeIn();
		}
 	},function(){
		$(this).css({"cursor":""});
		$('#pull-client').hide();
		$('.search-pulldown-2').removeClass("pullactive");									   
	});
	$('#pull-client').hover(function(){
		$('.search-pulldown-2').css({"cursor":""});
	});
	// -> HOVER LI pull down menus 
	$("#search_area li").hover(function(){
		if($("a", this).attr("class") != "disabled"){
			$(this).css({"cursor":"pointer","color":"#000000","background":"#FFFF00"});
		}
	}, function(){
		$(this).css({"cursor":"","color":"#666666","background":""});

	});
	$("#search_area span a").hover(function(){
		$(this).css({"cursor":"pointer","color":"#000000"});
	}, function(){
		$(this).css({"cursor":"","color":"#666666"});

	});

}
/* -------------------------------------------------------------------------------------------------------------------------- */
/* FIND AND SELECT INTO DROP DOWN MENUS*/
/* -------------------------------------------------------------------------------------------------------------------------- */
	// -> Product Selection
	function Drop_Product_Selection(oText){
		if(oText != ""){
			var found = '#search_area .search-pulldown-1 li#'+oText;
			if($(found).length > 0){
				$(found).children("a").css({"color":"#000000","background":"#FFFF00"});	
				nText = $(found).children("a").text();
				$(found).parent().parent().parent().parent().children("#selected-pulldown-1").text(nText).css({"text-transform":"capitalize","font-size":"12px"});
			} else if($(found).length <= 0){
				found = '#search_area .search-pulldown-1 span#'+oText+'-cat';
				$(found).children("a").css({"color":"#000000"});	
				nText = $(found).children("a").text();
				$("#selected-pulldown-1").text(nText).css({"text-transform":"capitalize","font-size":"12px"});
			} else {
				$('#search_area .search-pulldown-1 #selected-pulldown-1').text("--Select Work by Product--");
			}
		} else {
			$('#search_area .search-pulldown-1 #selected-pulldown-1').text("--Select Work by Product--");
		}
		
	}
	// -> Client selection
	function Drop_Client_Selection(oText){
		if(oText != ""){
			var found = '#search_area .search-pulldown-2 #'+oText;
			if($(found).length> 0){
				$(found).children("a").css({"color":"#000000","background":"#FFFF00"});	
				nText = $(found).children("a").text();
				$(found).parent().parent().parent().parent().children("#selected-pulldown-2").text(nText).css({"text-transform":"capitalize","font-size":"12px"});
			} else if($(found).length <= 0){
				found = '#search_area .search-pulldown-2 span#'+oText+'-cat';
				$(found).children("a").css({"color":"#000000"});	
				nText = $(found).children("a").text();
				$("#selected-pulldown-2").text(nText).css({"text-transform":"capitalize","font-size":"12px"});
			} else {
				$('#search_area .search-pulldown-1 #selected-pulldown-1').text("--Select Work by Product--");
			}
		} else {
			$('#search_area .search-pulldown-2 #selected-pulldown-2').text("--Select Work by Client--");
		}
		
	}
	
/* -------------------------------------------------------------------------------------------------------------------------- */
/* CONTENT SUB NAV SLIDE MENU */
/* -------------------------------------------------------------------------------------------------------------------------- */
function SubNav_Content(){
	// -> title-link:hover
	$('#nav-sub-1 div.title-link').hover(function(){
		$(this).css('cursor','pointer');
		$("a",this).css('color','#000000');
	}, function(){
		$(this).css('cursor','');
		$("a",this).css('color','#666666');	
	});
	// -> title:hover
	$('#nav-sub-1 div.title').hover(function(){
		$(this).css({'cursor':'pointer','color':'#000000'});
	}, function(){
		$(this).css({'cursor':'pointer','color':'#666666'});
	});
	// $("#nav-sub-1 ul").hide();
	$("#nav-sub-1 .title").toggleClass("active");
	 // -> title:click
	 $("#nav-sub-1 .title").click(function(){
		$(this).next("ul").slideToggle("slow")
		.siblings("ul:visible").slideUp("slow");
		$(this).toggleClass("active");
		$(this).siblings(".titles").removeClass("active");
	});
	// -> li:hover
	$("#nav-sub-1 ul li a").hover(function(){
		$(this).css({"cursor":"pointer"});		
	}, function(){
		$(this).css({"cursor":""});
	});
	$("#nav-sub-1 ul li").hover(function(){
		$("a",this).css({"color":"#000000","background":"#FFFF00"});
		$(this).addClass("active");
	}, function(){
		$("a",this).css({"color":"#666666","background":""});
		$(this).removeClass("active");
	});
}
/* -------------------------------------------------------------------------------------------------------------------------- */
/* SEARCH MENUS */
/* -------------------------------------------------------------------------------------------------------------------------- */
function Search_Config(){
	$("#search_bt").hover(function(){
		$(this).css({"cursor":"pointer"});
		$(this).css({"background-position":"left bottom"});
	}, function(){
		$(this).css({"cursor":""});
		$(this).css({"background-position":"left top"});
	});
}
/* -------------------------------------------------------------------------------------------------------------------------- */
/* TEAM */
/* -------------------------------------------------------------------------------------------------------------------------- */
function TeamInterface(){
	$(".MemberFoto").hover(function(){
		$(this).css({"cursor":"pointer"});
		$(this).css({"background-position":"0 -145px"});
	}, function(){
		$(this).css({"cursor":""});
		$(this).css({"background-position":"0 0px"});
	});
}
/* -------------------------------------------------------------------------------------------------------------------------- */
/* CONTACT STUDIO */
/* -------------------------------------------------------------------------------------------------------------------------- */
function ContactForm(){
  	$('.contact-sendButton-1').hover(function(){
	  $(this).css({"background-position":"0 -26px","cursor":"pointer"});										 
  	}, function(){
	  $(this).css({"background-position":"0 0","cursor":""});	
	});
	$('.contact-sendButton-2').hover(function(){
	  $(this).css({"background-position":"0 -26px","cursor":"pointer"});										 
  	}, function(){
	  $(this).css({"background-position":"0 0","cursor":""});	
	});
	//
	inText = "";
	$('form input').focusin(function() {
		inText = $(this).val();
		if ((inText=="Your name") || (inText=="Your url") || (inText=="Your phone") || (inText=="Your email address")){
         $(this).val('');
		}
    });
	$('form input').focusout(function() {
		if($(this).val() == inText || $(this).val() == ""){
         	$(this).val(inText);
		}
    });
	$('form textarea').focusin(function() {
		inText = $(this).val();
		if (inText=="Your message"){
         	$(this).val('');
		}
    });
	$('form textarea').focusout(function() {
		if($(this).val() == inText || $(this).val() == ""){
         	$(this).val(inText);
		}
    });
}
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		//limitCount.value = limitNum - limitField.value.length;
	}
}
/* -------------------------------------------------------------------------------------------------------------------------- */
/* SERVICES */
/* -------------------------------------------------------------------------------------------------------------------------- */
function linkAnimals(){
	//cursor pointer
	$('.click-animal-2').css({"cursor": "pointer"});	
	$('.click-animal-3').css({"cursor": "pointer"});
	$('.click-animal-4').css({"cursor": "pointer"});
	$('.click-animal-5').css({"cursor": "pointer"});
	$('.click-animal-6').css({"cursor": "pointer"});
	//click
	$('.click-animal-2').click(function(){
		window.location='/works/brand';
	});
	$('.click-animal-3').click(function(){
		window.location='/works/banner';
	});
	$('.click-animal-4').click(function(){
		window.location='/view/hotels-com-cross-media-campaign';
	});
	$('.click-animal-5').click(function(){
		window.location='/works/web';
	});
	$('.click-animal-6').click(function(){
		window.location='/works/print';
	});	
}
