// <summary>
// Global function calls
// </summary>
function ExecuteHandler(){
	
	
	//SetLightBox();	
	
	
	
	AssignCSSSelectors();
	AssignLinks();
 $(".HomeList li:even").addClass("Last");
 if (window.location.href.toLowerCase().indexOf("cmspagemode=edit")>0){
 return false;
 }

 if (window.location.href.toLowerCase().indexOf("cartoonacademy/")>0){
	$('.BlogCatList li').addClass('LeftToRight');
 }


 if (window.location.href.toLowerCase().indexOf("atfaloona/stories/")>0){
  $(".NewsDetails").find("div").hide();
  $(".NewsDetails").find("div:first").show();
  $(".NewsDetails").find("div img").css({width:"510px"});
  $(".NewsDetails").find ("div.sf_singleContent").show();
  $(".NewsDetails").find ("div.sf_singleContent").show();
  $(".NewsDetails").find ("div.sf_singleContent div").show();
  $(".NewsDetails").find ("div#comments").show();
  $(".NewsDetails").find ("div#comments div").show();
 }
 if (window.location.href.toLowerCase().indexOf("baraha/stories/")>0){
  $(".NewsDetails").find("div").hide();
  $(".NewsDetails").find("div:first").show();
  $(".NewsDetails").find("div img").css({width:"510px"});
  $(".NewsDetails").find ("div.sf_singleContent").show();
  $(".NewsDetails").find ("div.sf_singleContent").show();
  $(".NewsDetails").find ("div.sf_singleContent div").show();
  $(".NewsDetails").find ("div#comments").show();
  $(".NewsDetails").find ("div#comments div").show();
 }

 }

function show(ObjectId)
{
 $(".NewsDetails").find("div").hide();
 $("#"+ ObjectId).show();
}

// <summary>
//  This function to assign target blank to the external link. html target blank is not a standard w3c validated code. insted of using target="_blank" we use rel="external" and replace the rel with javascript.
// </summary>
function AssignLinks() 
{
	$("a[rel='external']").attr("target","_blank");
	$("a[href='#']").click(function(){
		return false;
	});
}

// <summary>
//  This function to attach non-ie css selectors to the html elements
// </summary>
function AssignCSSSelectors()
{
	if(jQuery.browser.msie)
	{
		$("li:first-child").addClass("FirstChild");
		$("li:last-child").addClass("LastChild");
		$("td:last").addClass("LastChild");
  $("tr:first").addClass("FirstChild");
	}
  $(".ImageGallery").find("tr").find("td:last").addClass("EndTd");
}
// <summary>
//  These functions handle events generated by an Input Text box
// </summary>

function InputTextOnFocusHandler (InputTag, DefaultText,TextType)
{
	try
	{  		
		if (InputTag.value == DefaultText)
		{
			InputTag.value = "";
			if (TextType=="Password")
			{
				//changeInputType(InputTag, "password",DefaultText,TextType);
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

function InputTextOnBlurHandler (InputTag, DefaultText,TextType)
{
	try
	{
		if (InputTag.value == "")
		{
			InputTag.value = DefaultText;	
			if (TextType=="Password")
			{
				//changeInputType(InputTag, "text",DefaultText,TextType);
			}
		}
	}
	catch (ExceptionObject)
	{
		//alert();
	}
}

// <summary>
// this function toggles the content. Used in FAQ module
// </summary>
function ToggleListItem()
{
 $(".Toggle").find("div").hide();
 $(".Toggle").children().each(function(){
  $(this).find("a").click(function(){
  if ($(this).parent().hasClass("Clicked"))
  {
   $(this).parent().find("div").slideUp(500);
  }
  else
  {
   $(this).parent().find("div").slideDown(500);
  }
  $(this).parent().toggleClass("Clicked");
 });
 });
}



// <summary>
//  setting the lightbox for image gallery
// </summary>
function SetLightBox()
{
	if($('.LightBoximg').length == true){

$('.LightBoximg a').attr("href",$('.LightBoximg a').find("img").attr("src"));
$('.LightBoximg a').lightBox();

}

 //$('.ImageGallery a').lightBox();
}



