/* 			js @ jQuery 1.4.2
			uk.co.focus23
            Focus23
			Wed, 19 May 2010

   			dsynr.com
   			a@dsynr.com
   			abhishek jain
   			2010 Genedrome.Tachyon
*/

$(document).ready(function()
{
	var path = window.location.pathname;
	sizeChild();
	$("h1.hide").html($("title").html());
	$("h2.hide").html(path);
	
	if(path.match("/new"))
	{
		 $('#news').attr("src", "lib/ima/news_red.png");
		 $('#news').parent().removeAttr("href");
		 $("#news").removeClass('enabled');
	 
	}
	else if(path.match("/nex"))
	{
		 $('#nextE').attr("src", "lib/ima/next_event_red.png");
		 $('#nextE').parent().removeAttr("href");
		 $("#nextE").removeClass('enabled');
	}
	else if(path.match("/pre"))
	{
		 $('#preE').attr("src", "lib/ima/previous_events_red.png");
		 $('#preE').parent().removeAttr("href");
		 $("#preE").removeClass('enabled');
	}
	else if(path.match("/ass"))
	{
		 $('#associates').attr("src", "lib/ima/associates_red.png");
		 $('#associates').parent().removeAttr("href");
		 $("#associates").removeClass('enabled');
	}
	else if(path.match("/con"))
	{
		 $('#contact').attr("src", "lib/ima/contact_red.png");
		 $('#contact').parent().removeAttr("href");
		 $("#contact").removeClass('enabled');
	}
	else
	{
		 $('#home a').removeAttr("href");
	}
	
	$("#home").hover(function () {
    $("#home img").fadeIn("normal");
	},
  function () {
  $("#home img").fadeOut("slow");
	}
	);
	
	
	$('#news.enabled').hover(function () {
    $(this).attr("src", "lib/ima/news_red.png");
	},
  function () {
  $(this).attr("src", "lib/ima/news_black.png");
	}
	);
	
	$('#nextE.enabled').hover(function () {
    $(this).attr("src", "lib/ima/next_event_red.png");
	},
  function () {
  $(this).attr("src", "lib/ima/next_event_black.png");
	}
	);
	
	$('#preE.enabled').hover(function () {
    $(this).attr("src", "lib/ima/previous_events_red.png");
	},
  function () {
  $(this).attr("src", "lib/ima/previous_events_black.png");
	}
	);
	
	$('#associates.enabled').hover(function () {
    $(this).attr("src", "lib/ima/associates_red.png");
	},
  function () {
  $(this).attr("src", "lib/ima/associates_black.png");
	}
	);
	
	$('#contact.enabled').hover(function () {
    $(this).attr("src", "lib/ima/contact_red.png");
	},
  function () {
  $(this).attr("src", "lib/ima/contact_black.png");
	}
	);
	
	
	$('#name').focus(function (){react("clearName");});
	$('#name').blur(function (){react("Name");});
	$('#email').focus(function (){react("clearEmail");});
	$('#email').blur(function (){react("Email");});
	
	function react(id)
	{	
		switch (id)
		{
			case "clearName":
			if($('#name').val() == "Name")
			{
				$('#name').val("");
			}
			break;
			case "Name":
			if($('#name').val() == "")
			{
				$('#name').val("Name");
			}
			break;
			case "clearEmail":
			if($('#email').val() == "Email")
			{
				$('#email').val("");
			}
			break;
			case "Email":
			if($('#email').val() == "")
			{
				$('#email').val("Email");
			}
			break;
		}
	}
	
		//var defaultTipTxt = "&larr; enlarge";
		var tipTxt = "swap &hArr; size";
		$(".imgR img").hover(
		function () {
		Tip(1, $(this).parent());
		},
		function () {
		Tip(0, this);
		}
		);
		
		$('.imgR img').click(function() {
		switch($(this).width())
		{
			case 284:
//		tipTxt = "switch &rarr;";
		$(this).animate({
		width: [150, 'swing'],
		height: [211, 'swing'],
		}, 500, 'linear', function() {
		sizeChild();
		});
			break;
			default:
	//		tipTxt = defaultTipTxt;
			$(this).animate({
		width: [284, 'swing'],
		height: [400, 'swing'],
		borderWidth: "10px",
		//WebkitBorderTopLeftRadius: 5,
		//WebkitBorderBottomLeftRadius: 5,
		//MozBorderRadius: 5,
		//BorderRadius: 5
		}, 500, 'linear', function() {
		sizeChild();
		});
			break;
		}
		});
		
		function Tip(cas, ele)
		{
			switch(cas)
			 {
				 case 1:
				 $(ele).append("<div class=\"tip\">"+tipTxt+"</div>");
				 $(".tip").fadeIn(500).delay(500).fadeOut(500); 
			 	 break;
				 case 0:
				 $(".tip").fadeOut(500, function(){$(".imgR div.tip").remove();});
				 
				 break;
			 }
		}
	
	function sizeChild(){
	$('#child').height($('#content').height() + 65);
	}
});
