$(document).ready(function() {
	
	//if ($('div.content-area-left').height() > $('div.content-area').height()) $('div.content-area').height($('div.content-area-left').height());
	
	$("#email").click(function () {
		if ($(this).attr("value") == 'e-mail') $(this).attr("value","");
    });    
    $("#email").blur(function () {
         if ($(this).attr("value") == '') $(this).attr("value","e-mail");
    });

	try 
	{
		$('form.trnsfrm').jqTransform({imgPath:'/f/i/'});
	}
	catch (err)
	{
		
	}
	
	try
	{
	  if (typeof(bugResize) != 'undefined')
     {
	if (bugResize == 1)
	{
		try
		{
			$("div.br_holder").find("div.jqTransformSelectWrapper").css('width','207px');
			$("div.br_holder").find("div.jqTransformSelectWrapper div span").css('width','183px');
			$("div.br_holder").find("div.jqTransformSelectWrapper ul").css('width','205px');
			$("div.br_holder").find("div.jqTransformSelectWrapper select").css('width','185px');
		}
		catch(e) {}
	}
	}
}
	catch(e)
	{}
	
	
	try
	{
	  if (typeof(NeedTagResize) != 'undefined')
     {
	if (NeedTagResize == 1)
	{
		try
		{
			if (($('#phototagsx').height()+210) > $('.content-mainpart').height())
			{
				$('.content-mainpart').height(($('#phototagsx').height()+230));
			}
		}
		catch(e) {}
	}
	}
}
	catch(e)
	{}
	
	
	try
	{
	  if (typeof(innerPage) != 'undefined')
     {
	if (innerPage == 1)
	{
		try
		{
			if (($('#lmh').height()+270) > $('#mainframe').height())
			{
				$('#mainframe').height(($('#lmh').height()+335));
			}
		}
		catch(e) {}
	}
	}
}
	catch(e)
	{}
	
	$("a.breeder_link").toggle(
      function () {
        var x = $(this).attr('id').substr(3);
		$('#ffxi').height($('#ffxi').height()+$('#contract_table_'+x).height());
		$('#contract_table_'+x).slideDown();
      },
      function () {
        var x = $(this).attr('id').substr(3);
		$('#contract_table_'+x).slideUp();
		$('#ffxi').height($('#ffxi').height()-$('#contract_table_'+x).height());
      }
    );
	
	
	//widget
	
	try
	{
		if (typeof(widgetInit) != 'undefined')
     {
	if (widgetInit == true)
	{
	var currentScore = parseInt($('#warning5').attr('rel'));

	
	$("a.widgetPic").click(
      function () {
		
		if (currentScore <= 5)
		{
			if ($(this).hasClass('selected'))
			{
				$(this).removeClass('selected');
				currentScore--;
				$('#warning5').attr('rel',currentScore);
				$('.itemAdder').css('visibility','hidden');
			}
			else
			{
				if (currentScore < 5)
				{
					$(this).addClass('selected');
					currentScore++;
					$('#warning5').attr('rel',currentScore);
					$('.itemAdder').css('visibility','visible');
				}
				else $('#warning5').effect("highlight", {}, 3000);
			}
		}
		else
		{
			if ($(this).hasClass('selected'))
			{
				$(this).removeClass('selected');
				currentScore--;
				$('#warning5').attr('rel',currentScore);
				$('#itemAdder').css('visibility','hidden');
			}
			else
			{
				$('#warning5').effect("highlight", {}, 3000);
			} 
		}
		//if ((currentScore > 0) && (currentScore < 6)) $('#itemAdder').css('visibility','visible'); else $('#itemAdder').css('visibility','hidden');
		return false;
      }
    );
    
    

	$("#addedItems li span.x").live("click", function()
		{
			$(this).parent().remove();
			currentScore--;
			$('#warning5').attr('rel',currentScore);
		}
	);
	
	$('div.wideRuler span').draggable({
		axis: "x",
		containment: "parent",
		stop: function(event, ui) {
			$('#sizeWidth').attr('value',parseInt($("#xox").css('left'))+150);
		}
	});
	
	$('#sizeWidth').change(function(){
		if (parseInt($(this).attr('value')) < 150) $(this).attr('value',150);
		if (parseInt($(this).attr('value')) > 500) $(this).attr('value',500);
		var newPos = parseInt($(this).attr('value')-150);
		$("#xox").css('left',newPos+'px');
	});
	}}
	}catch(e)
	{}
	
	try
	{
		if (typeof(NeedMenuResize) != 'undefined')
     {
	if (NeedMenuResize == 1)
	{
	
	
	
	var lmh = parseInt($('#lmh div.menu').height()) + parseInt($('#map').height()) + 100;

          var dfg = $('#main_p').height() + 438 + 75;
          var dmg = lmh + 120; // 250



          if (dfg > dmg)
          {
            $('#ffxi').height(dfg); // 370
          }
          else
          {
            $('#ffxi').height(dmg); // 170
          }
          
  }
}
}
catch(e) {}
	
});

jQuery(function( $ ){
	$('#top10scroll').serialScroll({
		target:'#t10-items',
		items:'li',
		prev:'#prev',
		next:'#next',
		duration: 200,
		cycle: false
	});
});