
$().ready(function(){
	flashLogo();
	flashBanner();

	//close the open foldout menu
//$('div.zmenu').children('ul').children('li').children('ul.zmenuinner').css({'display':'none'});

//open  the parent ul for submenu
if(gup('tx_ttnews[backPid]')){
	var openId = gup('tx_ttnews[backPid]');
	
}else{
	var openId = gup('id');
}

$('ul#zmenu-'+openId).css({'display':'block'});
$('a.active').parent('li').children('ul').css({'display':'block'})
//$('ul#zmenu-'+openId).prev('a.no').addClass('active');


//add the class active to active menu	
$("a.active").parents("li").children("a.no").addClass("active");
//open  the menu for active class
for(i=0;i < $('a.active').parents('ul').length;i++){
	$('a.active').parents('ul').css({'display':'block'});
}

if(gup('tx_ttnews[tt_news]')){
	$('.article-'+gup('tx_ttnews[tt_news]')).addClass('redBackground');
}




//remove  empty p tags start
	if(gup('id')!=21){	
		var f = $("div#maincontentonecolumn");
		if(f.length>0){
	 		$("div#maincontentonecolumn p.bodytext").each(function(){
				if($(this).html()=='&nbsp;'){
					$(this).remove();
				}
			});
	 	}
	}
	//remove rightarrow
$('.downarrowclass').remove();	
	
	if((gup('id')!=21)||(gup('id')!=168)){		
	var cat='';
	$('.news-category').each(function(data){
	    if(cat==$(this).text()){
	        $(this).hide();
	    }else{
	        cat = $(this).text();
	    }
	});	
		
}
	resizeLeft();
	removeHref();	
	MenuToggle();
	$("#share_now").tooltip({ effect: 'slide'}); 
});

function gup(name){
	if(!name){ return false;}
	 	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
		var regexS = "[\\?&]"+name+"=([^&#]*)";
		var regex = new RegExp( regexS );
		var results = regex.exec(window.location.href);
	if( results == null )
	  return "";
	else
	 return results[1];
 }

 
 function resizeLeft(){
 	var h = $('div.topRightContentIn').height();

 	var mHeight = $('div#topLeftContentIn').height();

 	if(h > mHeight){
 		var minh = h;
 	}else{
 		minh = mHeight;
 	}
 	
	$('#topLeftContentIn').css({"height":minh});
	
	//login box when there is no menu in left

	if($('div.zmenu').height()==0){
		$('.topLeftContentIn .logingBoxIn').css({'margin':0});
	}
 }

function removeHref(){
	$('a#menu-13').attr({ 'href' : 'javascript:void(0)'});
	$('a#menu-14').attr({ 'href' : 'javascript:void(0)'});
	$('a#menu-16').attr({ 'href' : 'javascript:void(0)'});
	$('a#menu-18').attr({ 'href' : 'javascript:void(0)'});
	$('a#menu-19').attr({ 'href' : 'javascript:void(0)'});
	$('a#menu-20').attr({ 'href' : 'javascript:void(0)'});
	
}



function MenuToggle(){	
	$('ul.level2').hover(function(){
			$(this).parent('li').addClass('cur');
		},
	function(){
		$(this).parent('li').removeClass('cur');
	}
)
	
}
function flashLogo(){
	var requiredMajorVersion = 9;
	var requiredMinorVersion = 0;
	var requiredRevision = 0;
	var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasReqestedVersion) {
		
	   var alternateContent =  AC_FL_RunContent(
		        "src", "./fileadmin/templates/style/images/logoAnimated",
		        "width", "240",
		        "height", "100",
		        "align", "middle",
		        "id", "logoAnimated",
		        "quality", "high",
		        "wmode", "opaque",
		        "bgcolor", "#ffffff",
		        "name", "logoAnimated",
		        "allowScriptAccess","sameDomain",
		        "type", "application/x-shockwave-flash",
		        'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
		        "pluginspage", "http://www.adobe.com/go/getflashplayer"
	    );
	 $('#MainLogo').html(alternateContent);
	} else {
		// flash is too old or we can't detect the plugin
		var alternateContent = '<img src="./fileadmin/templates/style/images/logo.gif" width="240" height="100" border="0">'+''+ '';
		$('#MainLogo').html(alternateContent);    //insert non-flash content
	}


}


function flashBanner(){
	var requiredMajorVersion = 9;
	var requiredMinorVersion = 0;
	var requiredRevision = 0;	
// Version check based upon the values entered above in "Globals"
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

// Check to see if the version meets the requirements for playback
if (hasReqestedVersion) {
	// if we've detected an acceptable version
	// embed the Flash Content SWF when all tests are passed
var alternateContent = AC_FL_RunContent(
				"src", "./fileadmin/templates/style/images/homeBanner",
				"width", "654",
				"height", "170",
				"align", "middle",
				"id", "homeBanner",
				"quality", "high",
				"wmode", "transparent",
				"bgcolor", "#ffffff",
				"name", "wmode",
				"allowScriptAccess","sameDomain",
				"type", "application/x-shockwave-flash",
				'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
				"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
	$('#homeBanners').html(alternateContent); 
} else {  // flash is too old or we can't detect the plugin
	var alternateContent = '<img src="./fileadmin/templates/style/images/flat_banner.jpg" width="654" height="170" border="0" />'+ ''+ '';
	$('#homeBanners').html(alternateContent); 
}

	
	
}




