/* 
 * Jquery browser detect plugin to identify browser/os detection.
 * jQuery Browser Plugin - http://jquery.thewikies.com/browser/
*/

(function($){$.browserTest=function(a,z){var u='unknown',x='X',m=function(r,h){for(var i=0;i<h.length;i=i+1){r=r.replace(h[i][0],h[i][1]);}return r;},c=function(i,a,b,c){var r={name:m((a.exec(i)||[u,u])[1],b)};r[r.name]=true;r.version=(c.exec(i)||[x,x,x,x])[3];if(r.name.match(/safari/)&&r.version>400){r.version='2.0';}if(r.name==='presto'){r.version=($.browser.version>9.27)?'futhark':'linear_b';}r.versionNumber=parseFloat(r.version,10)||0;r.versionX=(r.version!==x)?(r.version+'').substr(0,1):x;r.className=r.name+r.versionX;return r;};a=(a.match(/Opera|Navigator|Minefield|KHTML|Chrome/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));$.layout=c(a,/(gecko|konqueror|msie|opera|webkit)/,[['konqueror','khtml'],['msie','trident'],['opera','presto']],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);$.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||[u])[0].replace('sunos','solaris')};if(!z){$('html').addClass([$.os.name,$.browser.name,$.browser.className,$.layout.name,$.layout.className].join(' '));}};$.browserTest(navigator.userAgent,true);})(jQuery);


 /* add popup onClick handler for Chat Module for flyout*/
 
	function popUpChatWindow(){
   			//window.open("/chat/", "Window2", "width=730,height=561,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no"); 
			//return false;
	}
	
$(document).ready(function(){
	
	

	
	/* Setting the browser name and classname in the top */
	$("html").addClass($.os.name);
	$("body").addClass($.browser.className);
	
	/* for Required and Administrative icons - Starts */
	
	$('#join-294550.join .annotation span.private').each(function(){
			var cont = (this).innerHTML;		
			(this).innerHTML= prvteCont+cont;
		})
		
		$('li.input.private').each(function(){
			var liCont = (this).innerHTML;		
			(this).innerHTML= liCont+prvteCont;
		}) 
	
	/* for Required and Administrative icons - Ends */

	/* Suppresses display of empty footers on IE */
	$('.module .foot:empty').addClass('empty');
	/* START: Community drop-down for top nav */
	//Define XHTML source for the community subnav inn the variable below
	var communitySubNav = '<ul class="flyoutMenu" id="communitySubNav" style="display:none">\
		<li id="communityHomeNav"><a href="http://www.paramore.net/community-landing/">Community Home</a></li>\
		<li id="memberNav"><a href="http://www.paramore.net/member/">Fans</a></li>\
		<li id="discussionsNav"><a href="http://www.paramore.net/forums/">Discussions</a></li>';
	
	var FCSubNav = '<ul class="flyoutMenu" id="FCSubNav" style="display:none">\
			<li id="FCBlog"><a href="/blog/" >PFC Blog</a></li>\
			<li id="FCMemberNav"><a href="/member/" >PFC Members</a></li>\
			<li id="FCVideo"><a href="/video/" >PFC Videos</a></li>\
			<li id="FCPhoto"><a href="/photo/" >PFC Photos</a></li>\
			<li id="FCEvent"><a href="/blog/category/events/" >PFC Events</a></li>\
			<li id="FCContest"><a href="/blog/category/contests/" >PFC Contests</a></li>\
			<li id="FCForumNav"><a target="_blank" href="http://bbs.paramorefanclub.com/">PFC Forum</a></li>\
			<li id="faqNav"><a href="http://www.paramore.net/faq/">PFC FAQ</a></li>\
			<li id="FCForumOffer"><a href="http://bbs.paramorefanclub.com/pfc_offer/offer09.html" target="_blank">BNE Offer</a></li>\
			</ul>';
	
	/* add popup onClick handler for Chat Module in all the locations except for flyout*/
	
	$(".chatWindow").click(function() {
			//Commenting out the chat for the time being. 
			//window.open("/chat/", "Window2", "width=730,height=561,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no"); 
			//return false;
	});
			
	/* Fixing the target for the digg link */
	$(".shareweb .digg a").attr("target", "_new");
	var $customNavs = $('.nav_main ul li.nav-custom a');

	$customNavs.filter(function(){
	  return (/^01.Home$/i).test($(this).text())
	}).parent()
	  .addClass('nav-home');	
	
	$customNavs.filter(function(){
	  return (/^03.Videos$/i).test($(this).text())
	}).parent()
	  .addClass('nav-video');
	
	$customNavs.filter(function(){
	  return (/^02.Blogs$/i).test($(this).text())
	}).parent()
	  .addClass('nav-blog');
	
	$customNavs.filter(function(){
	  return (/^04.Photos$/i).test($(this).text())
	}).parent()
	  .addClass('nav-photo');	  
	  
	  	$customNavs.filter(function(){
	  return (/^06.Shows$/i).test($(this).text())
	}).parent()
	  .addClass('nav-tour_dates');
	  
	  	$customNavs.filter(function(){
	  return (/^07.Bio$/i).test($(this).text())
	}).parent()
	  .addClass('nav-bio');
	  
	  	$customNavs.filter(function(){
	  return (/^08.Community$/i).test($(this).text())
	}).parent()
	  .addClass('dropdown')
	  .addClass('nav-community_landing')
	  .append(communitySubNav);
	  
  
	  var $homeNavs = $('.nav_main ul li.nav-home a');
	  
	  	$homeNavs.filter(function(){
	  return (/^09.Fan Club$/i).test($(this).text())
	}).parent()
	  .addClass('nav-fanclub')
	  .addClass('dropdown')
	  .removeClass('nav-home')
	  .append(FCSubNav);
	  
	  
	$customNavs.filter(function(){
	  return (/05.Music/i).test($(this).text())
	}).parent()
	  .addClass('nav-music');
	
	$customNavs.filter(function(){
	  return (/^10.Store$/i).test($(this).text())
	}).parent()
	  .addClass('nav-store');	
	  

	$customNavs.filter(function(){
	  return (/^11.Global$/i).test($(this).text())
	}).parent()
	  .addClass('nav-global_int');
	
	

	$tempFBRDrpdwn = $('<li id="FBR_link"  style="display : inline" ><a id="FBR_LINK_Text" href="javascript:void(0)" >FUELEDBYRAMEN</a></li>');
	$tempFBRDrpdwn.insertBefore('#nav_global #nav_member ul li.hello');
	$tempFBRDrpdwn.insertBefore('#nav_global #nav_user ul li.signin'); 

	//$("body#login #login-294554 fieldset").append('<fieldset><strong>'+ loginAssistanceText +'</strong></fieldset>');
	
	//Define XHTML source for the community subnav inn the variable below
	var FBRSubNav = '<ul class="flyoutMenu" id="FBRSubNav" style="display:none">\
		<li id="moreFBR"><span> More from </span> <a target="_blank" href="http://www.fueledbyramen.com/">fueled by ramen</a></li>\
		<li id="emptytrail"> </li>\
		<li id="academyNav"> <a target="_blank" href="http://www.theacademyis.com/">The Academy Is...</a></li>\
		<li id="CabNav"> <a target="_blank" href="http://www.fueledbyramen.com/bands/index.php?id=54">The Cab</a></li>\
		<li id="CobraNav"> <a target="_blank" href="http://www.cobrastarship.com/">Cobra Starship</a></li>\
		<li id="ForgiveNav"> <a target="_blank" href="http://www.forgivedurden.com/">Forgive Durden</a> </li>\
		<li id="FridayNightNav"> <a target="_blank" href="http://www.myspace.com/thefridaynightboys">The Friday Night Boys</a> </li>\
		<li id="GymNav"> <a target="_blank" href="http://www.gymclassheroes.com/">Gym Class Heroes</a> </li>\
		<li id="panicatthediscoNav"> <a target="_blank" href="http://www.panicatthedisco.com/">Panic! At The Disco</a> </li>\
		<li id="PowerspaceNav"> <a target="_blank" href="http://www.powerspacetheband.com/">Powerspace</a> </li>\
		<li id="RocketNav"> <a target="_blank" href="http://www.myspace.com/arockettothemoon">A Rocket To The Moon</a> </li>\
		<li id="SwellersNav"> <a target="_blank" href="http://www.myspace.com/theswellers">The Swellers</a> </li>\
		<li id="ProvidenceNav"> <a target="_blank" href="http://www.thisprovidence.com/">This Providence</a> </li>\
		<li id="VersaEmergeNav"> <a target="_blank" href="http://www.myspace.com/versaemerge">VersaEmerge</a> </li>\
		<li id="emptytrail" class="FBR_foot"><div class="fbr_close"></div> </li>';
	var FBRNavCell = $("#nav_global ul #FBR_link");   //change this selector to target a diffent cell in the top nav
/*	FBRNavCell.addClass('dropdown');  */
	FBRNavCell.append(FBRSubNav);
	/* END: Community drop-down for top nav */

	$("#FBRSubNav .fbr_close").click( function(event) {
		$("ul#FBRSubNav").hide();		
	});
	
	$("#FBR_link #FBR_LINK_Text").click( function(event) {
				$("ul#FBRSubNav").show();		
	});
	
	
	//Modifying the legal text in the log in and sign up pages.
		$("body#sign_up #cmsgData\\[agreeToTerms\\]").next().html(privacyPolicyText + "")
		.show();
		$("body#join #cmsgData\\[agreeToTerms\\]").next().html(privacyPolicyText + "")
		.show();
		
	/* START: Community drop-down for top nav */
	//Define XHTML source for the community subnav inn the variable below
	var communitySubNav = '<ul class="flyoutMenu" id="communitySubNav" style="display:none">\
		<li id="memberNav"><a href="http://www.paramore.net/member/">Fans</a></li>\
		<li id="discussionsNav"><a href="http://www.paramore.net/forums/">Discussions</a></li>';
	var communityNavCell = $(".nav_main ul li.nav-community_landing");   //change this selector to target a diffent cell in the top nav
	communityNavCell.addClass('dropdown');
	communityNavCell.append(communitySubNav);
	/* END: Community drop-down for top nav */
	
	/* START: Store drop-down for top nav */
	//Define XHTML source for the community subnav inn the variable below
	var storeSubNav = '<ul class="flyoutMenu" id="storeSubNav" style="display:none">\
		<li><a href="http://store.paramore.net/" class="flag us" rel="external">US STORE</a></li>\
		<li><a href="http://paramore.warnerartists.com/eu" class="flag europe" rel="external">Europe Store</a></li>\
		<li><a href="http://paramore.warnerartists.com/en" class="flag uk" rel="external">UK Store</a></li>\
		<li><a href="http://www.mymusic.com/promotions/paramore/" class="flag canada" rel="external">Canada Store</a></li>\
		<li><a href="http://www.paramore.net.au" class="flag australia" rel="external">Australia Store</a></li>\
		<li><a href="http://www.paramore.com.mx" class="flag mexico" rel="external">Mexico Store</a></li>\
		<li><a href="http://item.rakuten.co.jp/warnermusic/d7567-89662/" class="flag japan" rel="external">Japan Store</a></li>\
		<li><a href="http://www.paramore.co.nz/" class="flag newzealand" rel="external">New Zealand Store</a></li>\
		<li id="ringtonesNav"><a href="http://www.paramore.net/ringtones/">Ringtones</a></li>';
	/* Make store top nav link open in a new window and add the subnav to the li*/
	$('.nav_main ul li.nav-custom a').filter(function(){
	  return (/\.Store/i).test($(this).text())
	}).attr("rel","external")
	  .parent()
	  .addClass('dropdown')
	  .addClass('tonesNav')	  
	  .append(storeSubNav);
	  
	 //Define XHTML source for the community subnav inn the variable below
	var bioSubNav = '<ul class="flyoutMenu" id="bioSubNav" style="display:none">\
		<li id="band"><a href="http://www.paramore.net/member/i/19155/"  class="profile" >Band Profile</a></li>\
		<li id="hayley"><a href="http://www.paramore.net/member/i/19150/"  class="profile" >Hayley&#39;s Profile</a></li>\
		<li id="jeremy"><a href="http://www.paramore.net/member/i/19151/"  class="profile" >Jeremy&#39;s Profile</a></li>\
		<li id="josh"><a href="http://www.paramore.net/member/i/19152/"  class="profile" >Josh&#39;s Profile</a></li>\
		<li id="taylor"><a href="http://www.paramore.net/member/i/19162/"  class="profile" >Taylor&#39;s Profile</a></li>\
		<li id="zac"><a href="http://www.paramore.net/member/i/19163/"  class="profile" >Zac&#39;s Profile </a></li>';
	/* Make store top nav link open in a new window and add the subnav to the li*/
	
	var bioNavCell = $(".nav_main ul li.nav-bio");   //change this selector to target a diffent cell in the top nav
	bioNavCell.addClass('dropdown');
	bioNavCell.append(bioSubNav);
		
/*	$('.nav_main ul li.nav-custom a').filter(function(){
	  return (/\.Store/i).test($(this).text())
	}).attr("rel","external")
	  .parent()
	  .addClass('dropdown')
	  .addClass('tonesNav')	  
	  .append(storeSubNav); */
	
	
	/* START: country drop-down for top nav */
	//Define XHTML source for the community subnav inn the variable below
	var countrySubNav = '<ul class="flyoutMenu" id="internationalSubNav" style="display:none">\
					<li id="australiaNav"><a href="http://www.paramore.net/au/" class="flag australia" >Australia</a></li>\
					<li id="canadaNav"><a href="http://www.paramore.net/ca/" class="flag canada" >Canada</a></li>\
	  				<li id="franceNav"><a href="http://www.paramore.net/fr/" class="flag france" >France</a></li>\
					<li id="germanyNav"><a href="http://www.paramore.net/de/" class="flag germany" >Germany</a></li>\
					<li id="italyNav"><a href="http://www.paramore.net/it/" class="flag italy" >Italy</a></li>\
					<li id="japanNav"><a href="http://www.paramore.net/jp/" class="flag japan" >Japan</a></li>\
					<li id="mexicoNav"><a href="http://www.paramore.net/mx/" class="flag mexico" >Mexico</a></li>\
					<li id="spainNav"><a href="http://www.paramore.net/es/" class="flag spain" >Spain</a></li>\
					<li id="ukNav"><a href="http://www.paramore.net/gb/" class="flag uk" >UK</a></li>';
					
	var countryNavCell =  $('.nav_main ul li.nav-global_int');    //change this selector to target a diffent cell in the top nav
	countryNavCell.addClass('dropdown');
	countryNavCell.append(countrySubNav);
	/* END: country drop-down for top nav */
	
	/*Hover event handler for all drop-downs in top nav */
	$(".dropdown").hover(
			function() { $(".flyoutMenu", this).show(); },
			function() { $(".flyoutMenu", this).hide(); }
	);
	
	
	if($("#sign_up-294578 li.input input").attr('class')== "focused"){		
		$descriptionDisplay = $("#sign_up-294578 li.input input.focused").parent().contents().filter(".message").children();
		if ($descriptionDisplay.css("display") == "inline" ||$descriptionDisplay.css("display") == "none"  ){
			$descriptionDisplay.css("display","block");
		}
	} 
	
	$("#sign_up-294578 li.input input").click( function() {
		// In this check for the corresponding description div. 		
		 $descriptionDisplay = $(this).next().filter(".message").children();
		if ($descriptionDisplay.css("display") == "inline"){
			$descriptionDisplay.css("display","block");
		}
	});
	
	$("#sign_up-294578 li.select input").click( function() {
		// In this check for the corresponding description div. 
		$descriptionDisplay = $(this).parent().contents().filter(".message").children();
		if ($descriptionDisplay.css("display") == "inline"){
			$descriptionDisplay.css("display","block");
		}
	});
	
			
	if (location.href.indexOf("/member/") != -1) {
		 if (!(location.href.indexOf("/category/member/") != -1)) {
		 	$(".nav-fanclub").addClass("active");
		 	$("#FCMemberNav").addClass("active");
		 }
	}

			
	if (location.href.indexOf("/talk/") != -1) {
			$(".nav-fanclub").addClass("active");
			$("#FCForumNav").addClass("active");
		}
	if (location.href.indexOf("/photo/") != -1) {
			$(".nav-fanclub").addClass("active");
			$("#FCPhoto").addClass("active");
		}	
	if (location.href.indexOf("/video/") != -1) {
			$(".nav-fanclub").addClass("active");
			$("#FCVideo").addClass("active");
		}	
			
	if (location.href.indexOf("/blog/") != -1) {
			$(".nav-fanclub").addClass("active");
		$("#FCBlog").addClass("active");
		}
		
	if (location.href.indexOf("/blog/category/events/") != -1) {
			$(".nav-fanclub").addClass("active");
			$("#FCEvent").addClass("active");
			$("#FCBlog").removeClass("active");
		}	
	
	if (location.href.indexOf("/blog/category/contests/") != -1) {
		$(".nav-fanclub").addClass("active");
		$("#FCContest").addClass("active");
		$("#FCBlog").removeClass("active");
	}
		
	/* START: Merch module drop-downs */
	$(".ArtistStore").hover (
			function() { $(".flyoutMenu", this).show(); },
			function() { $(".flyoutMenu", this).hide(); }
		);
			
	$(".mainAlbumBuyDrop").hover (
		function() { $("#subMainAlbumBuy", this).show(); },
		function() { $("#subMainAlbumBuy", this).hide(); }		
	);

	$(".productLeftBuyDrop").hover (
		function() { $("#subLeftAlbumBuy", this).show(); },
		function() { $("#subLeftAlbumBuy", this).hide(); }		
	);

	$(".productRightBuyDrop").hover (
		function() { $("#subRightAlbumBuy", this).show(); },
		function() { $("#subRightAlbumBuy", this).hide(); }		
	);

	$(".ArtistStoreBottom").hover (
		function() { $(".flyoutMenuFooter", this).show(); },
		function() { $(".flyoutMenuFooter", this).hide(); }		
	);
	/* END: Merch module drop-downs */
	
	
	/* Make rel="external" links open in a new window */
	$("a[rel=external]").attr("target", "_new");
	
	/* Append labels to elements in discussion module */
	$(".topics li.list .category li:first-child").prepend("Category: ");
	$(".topics li.list .activity").prepend("Replies: ");
	$(".topics li.list .date").prepend("Last Reply: ");
	
	/* Add "Close" text to close link in social media sharebox on photo and video detail pages */
	$(".sharebox .sb_head .sb_title a.shareclose").prepend("Close");
	
			/* Code for getting the url for events page*/
			
	var loc = document.location.href;
	var tmp = loc.substring(loc.indexOf("//")+2);
	var urltmp = tmp;
	tmp = tmp.substring(tmp.indexOf("/")+1);
		
	if (urltmp.indexOf("/blog/category/events/") != -1){
			$('#blog #wrapper h1').html("PFC EVENTS"); 
			$('#leftWrapper .blog_listing .module .content .head .title h3').html("EVENTS");
			$('#member_listing-294561.member_listing').css("display", "none");			
			$('body#blog #html-678678').css("display", "block");
		}
	
	if(urltmp.indexOf("/blog/")!=1){
		if ($('#blog_detail .article .category ul li a').text()=="Events"){
			$('#blog_detail #wrapper h1').html("PFC EVENTS"); 
			$('#leftWrapper .blog_entry .module .content .head h3').html("EVENTS");
			$('#member_listing-294561.member_listing').css("display", "none");
			$('body#blog_detail #html-678678').css("display", "block");
			$("#FCBlog").removeClass("active");
			$("#FCEvent").addClass("active");						
	}
	
	else if ($('#blog_detail .article .category ul li a').text() == "Contests") {
			$('#blog_detail #wrapper h1').html("PFC CONTESTS");
			$('#leftWrapper .blog_entry .module .content .head h3').html("CONTESTS");
			$('#member_listing-294561.member_listing').css("display", "none");
			$('body#blog_detail #html-678678').css("display", "block");
			$("#FCBlog").removeClass("active");
			$("#FCContest").addClass("active");			
		}

	}
	
	
	if (urltmp.indexOf("/blog/category/contests/") != -1){
		$('#blog #wrapper h1').html("PFC CONTESTS"); 
		$('#leftWrapper .blog_listing .module .content .head .title h3').html("CONTESTS");
		$('#member_listing-294561.member_listing').css("display", "none");			
		$('body#blog #html-678678').css("display", "block");
	}		
	
		$('#blog #wrapper h1').css("display", "block");
		$('#blog_detail #wrapper h1').css("display", "block");
		$('.blog_listing .module .content .head .title h3').css("display", "block");
		$('.blog_entry .module .content .head h3').css("display", "block");

	
	/* ********************* Code for Extras Module ************** */


			
/*	$("a.copyButton.active").click(function(){
		$(this).parents(".copyHtmlBox").css("display","none");
		return false}); */
		
	$("a.popupclose").click(function(){
		$(".imgSrcEmbed").css("visibility", "hidden");
	});	
	
	if ($("#home").length > 0) {
	
		$('#html-450137 .copyThisButton').attr("id", "button450137");
		$("#html-450137 .imgSrcEmbed").css("display", "block");
		/*** commenting out these things temporaryily Due to extras page absence. **/
		/*clipClient450137 = new ZeroClipboard.Client();
		clipClient450137.setHandCursor(true);
		clipClient450137.glue('button450137');
		clipClient450137.addEventListener('onMouseDown', buttonMouseDown450137);
		clipClient450137.addEventListener('complete', buttonCopyCmpltd450137);*/
		
		$("#html-450137 .homepage_extras img").click(function(){
			$("#html-450137 .imgSrcEmbed").css("visibility", "visible");
		});
		
		$("#html-450137 a.copyButton").click(function(){
			$("#html-450137 .imgSrcEmbed").css("visibility", "visible");
		});
		
	}
	else if ($("#extras").length > 0) {
		
			$('#html-450138 .copyThisButton').attr("id", "button450138");
			/*** commenting out these things temporaryily Due to extras page absence. **/
			/*clipClient450138 = new ZeroClipboard.Client();
			clipClient450138.setHandCursor(true);
			clipClient450138.glue('button450138');
			clipClient450138.addEventListener('onMouseDown', buttonMouseDown450138);
			clipClient450138.addEventListener('complete', buttonCopyCmpltd450138);*/
			
			$("#html-450138 .extrasUnitContainer .image img").click(function(){
				$("#html-450138 .imgSrcEmbed").css("visibility", "visible");
			});
			
			$("#html-450138 a.copyButton").click(function(){
				$("#html-450138 .imgSrcEmbed").css("visibility", "visible");
			});
			
			
			$('#html-440663 .copyThisButton').attr("id", "button440663");
			/*** commenting out these things temporaryily Due to extras page absence. **/
			/*clipClient440663 = new ZeroClipboard.Client();
			clipClient440663.setHandCursor(true);
			clipClient440663.glue('button440663');
			clipClient440663.addEventListener('onMouseDown', buttonMouseDown440663);
			clipClient440663.addEventListener('complete', buttonCopyCmpltd440663);*/
			
			$("#html-440663 .extrasUnitContainer .image img").click(function(){
				$("#html-440663 .imgSrcEmbed").css("visibility", "visible");
			});
			
			$("#html-440663 a.copyButton").click(function(){
				$("#html-440663 .imgSrcEmbed").css("visibility", "visible");
			});
			
			
			$('#html-440664 .copyThisButton').attr("id", "button440664");
			/*** commenting out these things temporaryily Due to extras page absence. **/
			/*clipClient440664 = new ZeroClipboard.Client();
			clipClient440664.setHandCursor(true);
			clipClient440664.glue('button440664');
			clipClient440664.addEventListener('onMouseDown', buttonMouseDown440664);
			clipClient440664.addEventListener('complete', buttonCopyCmpltd440664);*/
			
			$("#html-440664 .extrasUnitContainer .image img").click(function(){
				$("#html-440664 .imgSrcEmbed").css("visibility", "visible");
			});
			
			$("#html-440664 a.copyButton").click(function(){
				$("#html-440664 .imgSrcEmbed").css("visibility", "visible");
			});
			
			
			$('#html-440665 .copyThisButton').attr("id", "button440665");
			/*** commenting out these things temporaryily Due to extras page absence. **/
			/*clipClient440665 = new ZeroClipboard.Client();
			clipClient440665.setHandCursor(true);
			clipClient440665.glue('button440665');
			clipClient440665.addEventListener('onMouseDown', buttonMouseDown440665);
			clipClient440665.addEventListener('complete', buttonCopyCmpltd440665);*/
			
			$("#html-440665 .badgeContainer .image img").click(function(){
				$("#html-440665 .imgSrcEmbed").css("visibility", "visible");
			});
			
			$("#html-440665 a.copyButton").click(function(){
				$("#html-440665 .imgSrcEmbed").css("visibility", "visible");
			});
			
		}
		
		var noOfImageDscDtl=$("#discussion_entry-294529 .topic .description img").length;
		for(i=0;i<noOfImageDscDtl;i++){
			var discussionImageElement = $("#discussion_entry-294529 .topic .description img:eq(" +i+ ")");
			var imgHeight=discussionImageElement.height();
			var imgWidth=discussionImageElement.width();
			if(imgHeight>200 && imgWidth>200){		
				var calcheight = (imgHeight/imgWidth)*200;		
				discussionImageElement.css("height",calcheight);	
				discussionImageElement.css("width",200);	
			}
			
		}
	
	
	var noOfImageDscDtl=$("#discussion_listing-440467  .topic .description img").length;
		for(i=0;i<noOfImageDscDtl;i++){
			var discussionImageElement = $("#discussion_listing-440467 .topic .description img:eq(" +i+ ")");
			var imgHeight=discussionImageElement.height();
			var imgWidth=discussionImageElement.width();
			if(imgHeight>200 && imgWidth>200){		
				var calcheight = (imgHeight/imgWidth)*200;		
				discussionImageElement.css("height",calcheight);	
				discussionImageElement.css("width",200);	
			}
			
		}	
/* To add the odd class to achieve alternate colouring for the modules */	
	alternateColouringListing();
	
	function buttonMouseDown450137(client) {	
	client.setText( $('#moduleForm450137 .copyTxtArea').val());
	}
	
	function buttonCopyCmpltd450137(client){
	$("#html-450137 .copyTxtArea").focus().select();
	writeToConsole("This is a dummy text for the future.");
	}
	
	function buttonMouseDown450138(client) {
		
	client.setText( $('#moduleForm450138 .copyTxtArea').val());
	}
	
	function buttonCopyCmpltd450138(client){
				$("#html-450138 .copyTxtArea").focus().select();	
	writeToConsole("This is a dummy text for the future.");
	}
	
	function buttonMouseDown440663(client) {
			
	client.setText( $('#moduleForm440663 .copyTxtArea').val());
	}
	
	function buttonCopyCmpltd440663(client){
	$("#html-440663 .copyTxtArea").focus().select();
	writeToConsole("This is a dummy text for the future.");
	}
	
	function buttonMouseDown440664(client) {
		
	client.setText( $('#moduleForm440664 .copyTxtArea').val());
	}
	
	function buttonCopyCmpltd440664(client){
	$("#html-440664 .copyTxtArea").focus().select();	
	writeToConsole("This is a dummy text for the future.");
	}
	
	function buttonMouseDown440665(client) {
			
	client.setText( $('#moduleForm440665 .copyTxtArea').val());
	}
	
	function buttonCopyCmpltd440665(client){
	$("#html-440665 .copyTxtArea").focus().select();
	writeToConsole("This is a dummy text for the future.");
	}
	
/* To add the odd class to achieve alternate colouring for the modules */	
	alternateColouringListing();
	
	/*START- code which obfuscates email addresses #2420*/	
		var m_ = "mailto:";
		var a_ = "@";
		var d_ = ".";
		var i = 0;
		var j  = 0;
		var q_ = "?";
		var e_ = "=";
		
		$('span.ciReplace').each(function(){	
			if(cId[i].format == ""){
				$(this).html('<a href="'+m_+cId[i].name+a_+cId[i].domain+d_+cId[i].tld+'">'+ cId[i].name + a_+ cId[i].domain + d_+ cId[i].tld +'</a>');
			}
			else{
				if(cId[i].param == ""){
					$(this).html('<a href="'+m_+cId[i].name+a_+cId[i].domain+d_+cId[i].tld+'">'+ cId[i].format+'</a>');
				}
				else{
					$(this).html('<a href="'+m_+cId[i].name+a_+cId[i].domain+d_+cId[i].tld+q_+'subject'+e_+cId[i].param+'">'+cId[i].format+'</a>');
				}
			}
		i++;				
		});
		
		
		$('span.footReplace').each(function(){
					if(fId[j].format == ""){
				$(this).html('<a href="'+m_+fId[j].name+a_+fId[j].domain+d_+fId[j].tld+'">'+ fId[j].name + a_+ fId[j].domain + d_+ fId[j].tld +'</a>');
			}
			else{
				if(fId[j].param == ""){
					$(this).html('<a href="'+m_+fId[j].name+a_+fId[j].domain+d_+fId[j].tld+'">'+ fId[j].format+'</a>');
				}
				else{
					$(this).html('<a href="'+m_+fId[j].name+a_+fId[j].domain+d_+fId[j].tld+q_+'subject'+e_+fId[j].param+'">'+fId[j].format+'</a>');
				}
			}
			j++;		
		});	
		
	/*End - code which obfuscates email addresses #2420*/	

});

function eoscInit(){
	alternateColouringListing();
	$('#moduleForm294541 .note').html(forgotPasswordText);
}

function alternateColouringListing(){
	
   $('#blog_listing-294512 ul.articles li:nth-child(odd)').addClass('odd');
   $('#comments-294522 ul li:nth-child(odd)').addClass('odd');
   $('#comments-294523 ul li:nth-child(odd)').addClass('odd');
   $('#comments-294524 ul li:nth-child(odd)').addClass('odd');
   $('#comments-294525 ul li:nth-child(odd)').addClass('odd');
   $('#comments-294526 ul li:nth-child(odd)').addClass('odd');
   $('#comments-294527 ul li:nth-child(odd)').addClass('odd');
   
   $('#comments-383752 ul li:nth-child(odd)').addClass('odd');
			
	$('#rss_content-682267 ul.bbcDiscussionWrapper li:nth-child(odd)').addClass('odd');   
	$('#rss_content-679381 ul.topFiveBlogWrapper li:nth-child(odd)').addClass('odd');  
   $('#site_activity-327537 ul.events li:nth-child(odd)').addClass('odd');
   $('#site_activity-340500 ul.events li:nth-child(odd)').addClass('odd');
   $('#discussion_listing-340654 ul.topics li.topic:nth-child(odd)').addClass('odd');
   $('#discussion_listing-294531 ul.topics li.topic:nth-child(odd)').addClass('odd');
   $('#discussion_listing-294533 ul.topics li.topic:nth-child(odd)').addClass('odd');
      $('#discussion_listing-440467 ul.topics li.topic:nth-child(odd)').addClass('odd');

   
   $('#list_audio-294553 ul.songs li.audio:nth-child(odd)').addClass('odd');
   
   
   /************ International pages discussion **********/ 
   $('#discussion_listing-497799 ul.topics li.topic:nth-child(odd)').addClass('odd');   
   $('#discussion_listing-497807 ul.topics li.topic:nth-child(odd)').addClass('odd');
   $('#discussion_listing-490500 ul.topics li.topic:nth-child(odd)').addClass('odd');
   $('#discussion_listing-497815 ul.topics li.topic:nth-child(odd)').addClass('odd');
   $('#discussion_listing-497803 ul.topics li.topic:nth-child(odd)').addClass('odd');
   $('#discussion_listing-497811 ul.topics li.topic:nth-child(odd)').addClass('odd');
}
