/* 
 * 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);

/*
 * Jquery Plugin - opens external links in a new window.  
 * Checks if the links are relative, and are of the same domain.
 * Sampe Usage - $("#someDiv a").makeLinksExternal();
 */
jQuery.fn.makeLinksExternal=function(){return this.each(function(){var a=$(this).attr("href");if(a.indexOf(location.host)==-1&&a.indexOf("/")!=0){$(this).attr("target","_blank")}})};


/* Supplant Function. Remedial JS. Thanks to Douglas Crockford. 
 * Substitues the variables in a string. The variables must be preceded by {}.
*/

if(!String.prototype.supplant){String.prototype.supplant=function(a){return this.replace(/{([^{}]*)}/g,function(d,c){var e=a[c];return typeof e==="string"||typeof e==="number"?e:d})}};

var tourSubNav='<ul style="display: none;" id="tourSubNav" class="flyoutMenu">\
	<li id="upcomingNav"><a class="upcoming" href="/event/">UPCOMING</a></li>\
	<li id="pastNav"><a class="past" href="/past-shows/">PAST</a></li>\
	</ul>';

/*Templates for the Merch Module */
var merchModuleTemplate = 
		'<li class="merch small item{index}">\
				<div class="merchImg"><a href="{omnitureLinksPThumb}" title="{merchTitle}"><img src="{merchImage}" alt="{merchTitle}"/></a><div class="merchZoomIcon"></div></div>\
				<div class="merchDetail">\
					<div class="merchPriceWrapper"><div class="merchName"><a href="{omnitureLinksPTitle}" >{merchTitle}</a></div><div class="merchPrice">{merchPrice}</div></div>\
					<div class="merchBuy"><a href="{omnitureLinksPButton}" class="merchBuyLink">{merchPrice}</a></div>\
				</div>\
				<!-- HOVERCARD -->\
		</li>';

/* Templates for the Hovercard module.*/
var	merchHCTemplate ='<div class="merchHC merchHC{index}">\
							<div class="merchHCWrapper">\
								<div class="merchHCInnerWrapper">\
									<div class="merchHCHead"><a href="{omnitureLinksHTitle}">{merchTitle}</a></div>\
									<div class="merchHCBody">\
										<div class="merchHCLeftCon"><a href="{omnitureLinksHThumb}"  title="{merchTitle}"><img src="{merchImage}" alt="{merchTitle}" width="230px"/></a></div>\
										<div class="merchHCRightCon">\
											<h3 class="merchHCPrice">{merchPrice}</h3>\
											{merchDesc}\
											{merchSizes}\
											<div class="merchHCBuyNowCon"><a class="merchHCBuyNow" href="{omnitureLinksHButton}">Buy Now &raquo;</a></div>\
										</div>\
										<div class="clear"></div>\
									</div>\
									<div class="merchHCFoot"></div>\
								</div>\
							</div>\
						</div>';
			
var merchCountryTemplate = '<li><a class="flag {countryName}" href="{countryLink}" target="_new">{countryText}</a></li>';
var merchHeaderTemplate = '<div class="{positionClass}">\
						   		<div class="visitStore">\
									<a class="visitStoreLink" href="{merchViewAllLink}" rel="external" target="_new">Visit Jason\'s Store</a>\
									<ul style="display: none;" class="visitStoreFlyout">\
										<!-- MERCH COUNTRIES -->\
									</ul>\
								</div>\
						   </div>';
						   
var fraGlbNav = {
		"Home" :"Accueil",
		"News" :"News",
		"Music" :"Discographie",
		"Videos" :"Videos",
		"Photos" :"Photos",
		"Bio" :"Bio",
		"Tour_Dates" :"Concerts",
		"Community" :"Communauté",
		"Store" :"Boutique",
		"cellstream":"Mobile",
		"videoTitle":"Videos",
		"forumTitle":"Forum",
		"upcomingShows":"Concerts à venir",	
		"upcomingShowsText":"Voir les prochains concerts",		
		"discussions":"Forum",
		"upcoming":"à Venir",
		"past":"Passé",
		"viewMore":"Voir plus",
		"nowplaying":"EN LECTURE",
		"launchplayer":"Lancer le player",
		"moremusic":"plus de musique"
	};
	
var gerGlbNav = {
		"Home" :"Home",
		"News" :"News",
		"Music" :"Diskografie",
		"Videos" :"Videos",
		"Photos" :"Fotos",
		"Bio" :"Biografie",
		"Tour_Dates" :"Termine",
		"Community" :"Community",
		"Store" :"Shop",
		"cellstream":"Handy Stream",
		"videoTitle":"Videos",
		"forumTitle":"Forum",
		"upcomingShows":"Nächste Shows",	
		"upcomingShowsText":"Nächste Shows anzeigen",		
		"discussions":"Diskussionen",
		"upcoming":"Anstehende Konzerte",
		"past":"Vergangene Konzerte",
		"viewMore":"Mehr",
		"nowplaying":"Aktuelle Wiedergabe",
		"launchplayer":"Player starten",
		"moremusic":"mehr musik"
	};

var netGlbNav = {
		"Home" :"Home",
		"News" :"Nieuws",
		"Music" :"Muziek",
		"Videos" :"Video's",
		"Photos" :"Foto's",
		"Bio" :"Biografie",
		"Tour_Dates" :"Agenda",
		"Community" :"Community",
		"Store" :"Webshop",
		"cellstream":"Mobiele stream",
		"videoTitle":"Videos",
		"forumTitle":"Forum",
		"upcomingShows":"Aanstaande shows",	
		"upcomingShowsText":"Bekijk aanstaande shows",		
		"discussions":"Forum",
		"upcoming":"Volgende",
		"past":"eerder",
		"viewMore":"Bekijk allemaal",
		"nowplaying":"Speelt nu",
		"launchplayer":"Start muziekspeler",
		"moremusic":"Meer muziek"
	};

$(document).ready(function(){

	
	
	



$('#nav_main-294563 ul li.nav-tour_dates a').attr('href', '/event/');
	
modifyMediaSize(".photo_thumbnail .photos li .img a img","_6","display:block !important;width:161px !important;height: 161px !important;","display:block !important;width:161px !important;height: 161px !important;cursor:pointer !important;",false);
modifyMediaSize(".video_thumbnail .videos li .img a img","_6","display:block !important;width:161px !important;height: 115px !important;","display:block !important;width:161px ;height: 115px ;cursor:pointer !important;",true);
modifyMediaSize(".photo_thumnail .photos li .img a img","_6","display:block !important;width:161px !important;height: 161px !important;","display:block !important;width:161px !important;height: 161px !important;cursor:pointer !important;",false);

modifyMediaSize("#video_thumbnail-5572799.video_thumbnail .videos li .img a img","_6","display:block !important;width:220px ;height:158px ;","display:block !important;width:220px ;height:158px ;cursor:pointer !important;",true);
modifyMediaSize("#contest_entries #video_thumbnail-5572799.video_thumbnail .videos li .img a img","_6","display:block !important;width:163px ;height:116px ;","display:block !important;width:163px ;height:116px ;cursor:pointer !important;",true);
modifyMediaSize("#video_thumbnail-5645626.video_thumbnail .videos li .img a img","_6","display:block !important;width:220px ;height:158px ;","display:block !important;width:220px ;height:158px ;cursor:pointer !important;",true);

modifyTourModule();

/* tour page modification */

var clearDivEle='<div class="clear"></div>';
	var horzDivdr='<div class="hd"></div>';
	var currentPageShowUrl=$.urlParam("show");

  	
	

 
 

	

	
	if($('body#event').length >0 || $('body#event_detail').length >0 ){	
		var currentpageshow=$.urlParam("show");
		

		if ($('body').attr('id') == 'event_detail') {
			var eventdate = $('#event-707479.event .module .head h3 .date span').text();
			eventdateobj = new Date(eventdate);
			currentDate = new Date();
			offset = eventdateobj.getTime() - currentDate.getTime();		
			offsetdays=offset/ 86400000;
			if (currentpageshow == "archive" || offsetdays < -1 ) {

				$('#photo_thumbnail-3824954').css("display", "none");
				$('#video_thumbnail-3824955').css("display", "none");		
				$('#event_listing-3828537').css("display", "block");
				$('#event_listing-3828537 .nav_meta ul li.more a').attr('href', '/past-shows/');
				$('#event_listing-3828536').css("display", "none");
				$('#event-707479 .module .body .nav_meta ul li.buy').css("display","none");
				$('#event-707479 .module .body .article.cal_event div.availability').remove();
			}
			else {
			
				$("#event-707479 .module .body .cal_event .rating").css("display","none");
				$('#photo_thumbnail-3824954').css("display", "none");
				$('#video_thumbnail-3824955').css("display", "none");
				$('#event_listing-3828537').css("display", "none");
				$('#event_listing-3828536').css("display", "block");
				
				var availabilityText=$('#event-707479 .module .body .article.cal_event div.availability').text().trim();
				if(availabilityText.toUpperCase()!="SOLD OUT"){
				$('#event-707479 .module .body .article.cal_event div.availability').remove();
				}
			}
			

			}
		}
	
	

	
	

	

	
	

		

	
	
	$('#event .grid_5 .event_listing .head .nav_meta ul li.more a ').each(function(){
		$(this).html("VIEW MORE");
	});
	
	$('#event_detail .grid_5 .event_listing .head .nav_meta ul li.more a ').each(function(){
		$(this).html("VIEW MORE");
	});
	
	
	
	/* ******************** Tour page modifications ends ******************** */	
	
	   //Album detail stuff 
    $buylinks = $('#album_info-383751 .foot .nav_meta ul');
    $buylinks.insertBefore('#album_info-383751 .album .txt div.description');
    $('#album_info-383751.album_info .module .content .foot .nav_meta ul').css("display", "block");	
  
    
	/* New tour page functionality - Ends */
	

$(".module .content .foot").each(function(){
		var footMeta = $(this).find('.nav_meta');
		var footPage = $(this).find('.nav_page');
		$(this).siblings('.body').append(footMeta);
		$(this).siblings('.body').append(footPage);
		});

	
	var musicPlayerTitle='<div class="head"><h3>Now Playing</h3></div>';
	$(musicPlayerTitle).insertBefore($('.grid_5 .song_playlist .module .content .body'));
	
	
	$('.song_playlist .module .content .body li').each(function(){
	var musicTitle=$(this).find('.txt .title');
	var albumTitle=$(this).find('.txt .album');
	$(this).find('.txt').html(musicTitle);
	$(albumTitle).insertAfter($(this).find('.txt .title'));
	
	});
	
    /* Suppresses display of empty footers on IE */
    $('.module .foot:empty').addClass('empty');
	
	$("html").addClass($.os.name);
	$("body").addClass($.browser.className);
    $("body").addClass($.browser.name);
	
    /* START Add "Launch Player" links to footer nav of all audio playlist modules */
    var launchLink = $('<li class="launchPlayer"><a href="/music-player/" class="launchPlayerLink">Launch Player</a></li>');
    $(".song_playlist .module .content .nav_meta ul").prepend(launchLink);
    /* END Add "Launch Player" links to footer nav of all audio playlist modules */
    
	//The var "chatEnabled" is declared in subnav links html module
	//Initially this module is set to display:none using css.
	//if(chatEnabled.toLowerCase()=="true"){
	//	$("#html-2050856.html").css("display","block");
	//}
	//inserts the merch module into left wrapper
	$('#html-2050857.html .module .content .body .description .chatContainer #leftWrap').append($('#html-327531.html .module .content .body .description #merchContainer'));
		
    /* add popup onClick handler for audio player links */
    $("a.launchPlayerLink").click(function(){
        window.open("/music-player/", "Window2", "width=368,height=270,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no");
        return false;
    });
    
    /* Make store top nav link open in a new window */
    $('.nav_main ul li.custom a[href*=amazon.com]').attr("rel", "external");
    
	/*START - Fix for truncating author name in the discussions page #698 */
			$('.discussion_listing .topics li .author a').each(function(){
				var trunc = (this).innerHTML;
				if (trunc.length > discussionAuthorLen) {
					trunc = trunc.substring(0, discussionAuthorLen);
					trunc += '<span>' + '...</span>';
					(this).innerHTML = trunc;
				}	
			})		
	/*END - Fix for truncating author name in the discussions page #698 */
	
		
    $("a[href^=http://starterfanclub1.wmg.ciscoeos.com]").parent(".custom").addClass("Fanclub");
	
	/* START: Community drop-down for top nav */
    //Define XHTML source for the community subnav inn the variable below	
  	  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: Custom drop-downs for top nav */
	var $customNavs = $('.nav_main ul li.nav-custom a');
  
	  $customNavs.filter(function(){
	  return (/^Music/i).test($(this).text())
	}).parent()
  	  .addClass('nav-custom')
	  .addClass('nav-music');
	  
	  
	  $customNavs.filter(function(){
	  return (/^Fan Club$/i).test($(this).text())
	}).parent()
	  .addClass('nav-custom')
	  .addClass('dropdown')
	  .removeClass('nav-home')
	  .append(FCSubNav);
	  
	 $customNavs.filter(function(){
		  return (/^Store$/i).test($(this).text())
		}).parent()
    	  .addClass('nav-custom')
		  .addClass('nav-store')
		 	
	  
	 $customNavs.filter(function(){
		  return (/^Global$/i).test($(this).text())
		 }).parent()
 		  .addClass('nav-custom')
		  .addClass('dropdown')
		  .addClass('nav-global_int')
		  .append(globalSubNav);
		  
	/* START: Bio drop-down for top nav */

 	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);
	/* END: Bio drop-down for top nav */
	
	/* START: Tour drop-down for top nav */

 	var tourNavCell = $(".nav_main ul li.nav-event"); //change this selector to target a diffent cell in the top nav
 	tourNavCell.addClass('dropdown');
 	tourNavCell.append(tourSubNav);
	/* END: Bio drop-down for top nav */
	
	/* END: Custom drop-downs for top nav */
	
	$("body#bio #bioLinks").delegate ("a","click",function(){
		$($(this).attr("href")).scrollToViewPort();
		return false;
	})
	
	$("body#bio .bioBack").click (function(){
		$($(this).attr("href")).scrollToViewPort();
		return false;
	}); 
	
	/* ********** Home Page SS3 *********************** */
	
	/* Removing the upload from the top, and adding at the bottom; */
	var uploadDiv = $("#homepage_ss3 .nav_main ul li.upload");
	$("#homepage_ss3 .nav_main div > ul").append(uploadDiv);
	
	/* Carousel Button */
	/* algo 
	 * Have an event handler for the click of the buttons.
	 * Have global variables like currentActiveCaros
	 * 
	 * 
	 */	
	 var carosActiveCurrent = 0;
	 var carosTotal = $("#carosUnitWrapper .carosUnit").length;

	 if (carosTotal > 1){
	 	$("#rightCarosButton").addClass('active');
	 	$("#carosUnitWrapper .carosUnit:eq("+ carosActiveCurrent +")").toggle(100);
	 }
	 	 
	 $("#rightCarosButton").click(function (event){
	 	 if (carosTotal-carosActiveCurrent != 1){
		 	$("#carosUnitWrapper .carosUnit:eq("+ carosActiveCurrent +")").toggle(100);
			carosActiveCurrent++;
		 	$("#carosUnitWrapper .carosUnit:eq("+ carosActiveCurrent +")").toggle(100);
		 }
		 setCarosButtonsState();
		 
		});
	 $("#leftCarosButton").click(function (event){
	 	 if (carosActiveCurrent > 0 ){
		 	$("#carosUnitWrapper .carosUnit:eq("+ carosActiveCurrent +")").toggle();
			carosActiveCurrent--;
		 	$("#carosUnitWrapper .carosUnit:eq("+ carosActiveCurrent +")").toggle();
		 }
		 setCarosButtonsState();
		});
		function setCarosButtonsState(){
			
			 if (carosActiveCurrent == carosTotal-1 ){
				 	$("#rightCarosButton").removeClass('active');
			 }else {
				 	$("#rightCarosButton").addClass('active');
			 }
			 if (carosActiveCurrent == 0){
				 $("#leftCarosButton").removeClass('active');
			 }else {
		   	 	 $("#leftCarosButton").addClass('active');
			 }
		};
		
		/* ********** Home Page SS3 ends *********************** */	 	  

	
	
	var storeNavCell= $(".nav_main ul li.nav-store"); 
	
    /*Hover event handler for all drop-downs in top nav */
    $(".dropdown").hover(
		function(){$(".flyoutMenu", this).show();}, 
		function(){$(".flyoutMenu", this).hide();}
	);
    
  
	
    if (location.href.indexOf("/forums/") != -1) {
        communityNavCell.addClass("active");
        $("#discussionsNav").addClass("active");
    }
    if (location.href.indexOf("/ringtones/") != -1) {
        storeNavCell.addClass("active");
        $("#ringtonesNav").addClass("active");
    }
		
	 if (location.href.indexOf("/community_landing/") != -1) {
        communityNavCell.addClass("active");
        $("#communityNav").addClass("active");
    }
	
	if (location.href.indexOf("/event/") != -1){
		tourNavCell.addClass("active");
		$('#upcomingNav').addClass("active");
	}
	
	if (location.href.indexOf("/past-shows/") != -1){
		tourNavCell.addClass("active");
		$('#pastNav').addClass("active");
	}
	
	 if (location.href.indexOf("/extras/") != -1) {
        communityNavCell.addClass("active");
        $("#extrasNav").addClass("active");
    }
	/*For international pages*/
	var globalNavCell=$(".nav_main ul li.nav-global");
	
	 if (location.href.indexOf("/es/") != -1) {
		globalNavCell.addClass("active");
		$("#esNav").addClass("active");
		}
		if (location.href.indexOf("/jp/") != -1) {
		globalNavCell.addClass("active");
		$("#jpNav").addClass("active");
		} 
		
		if (location.href.indexOf("/gb/") != -1) {
		globalNavCell.addClass("active");
		$("#gbNav").addClass("active");
		} 
		 if (location.href.indexOf("/de/") != -1) {
		globalNavCell.addClass("active");
		$("#deNav").addClass("active");
		}
	
    var photoNavCell = $(".nav_main ul li.photo");
    if (location.href.indexOf("/cellstream/") != -1) {
        photoNavCell.addClass("active");
    }
    
	
	var musicNavCell=$(".nav_main ul li.nav-music");
	
    if (location.href.indexOf("/music/") != -1) {
        musicNavCell.addClass("active");
        
    }
    
    if (location.href.indexOf("/album/") != -1) {
        musicNavCell.addClass("active");
    }
	
	var homeNavCell=$(".nav_main ul li.nav-home");
	if ($("body").hasClass('international')) {
		homeNavCell.addClass("active");
	}
				
    /* ********** Merch module code ********* */
	$('#merchContainer').parent(".description").parent(".body").siblings(".head").addClass("clearfix");				
		$('#merchContainer').parent(".description").parent(".body").siblings(".head").children("h3").css({'border':'none','font-size':'25px'});				
	$('#merchContainer').parent(".description").parent(".body").siblings(".head").css({'position': 'relative','z-index': '100'});
	$('#merchContainer').parent(".description").parent(".body").siblings(".foot").css({'z-index': '98','overflow': 'visible'});
	$('#merchContainer').parent(".description").parent(".body").css({'position': 'relative','clear': 'both','z-index': '99'});

	var	visitStorehead = $('#merchContainer').parent(".description").parent(".body").siblings(".head");
	$('#merchContainer .merchHead').appendTo(visitStorehead);

	var	visitStoreFoot = $('#merchContainer').parent(".description").parent(".body").siblings(".foot");
	$('#merchContainer .merchFoot').appendTo(visitStoreFoot);

	$('#merchContainer').parent(".description").parent(".body").siblings(".foot.empty").addClass("emptyfix");
	    
	/* START: Merch module drop-downs */	
	$(".merchHead .visitStore").hover (
			function() { $(".visitStoreFlyout", this).show(); },
			function() { $(".visitStoreFlyout", this).hide(); }
		);
	$(".merchFoot .visitStore").hover (
		function() { $(".visitStoreFlyout", this).show(); },
		function() { $(".visitStoreFlyout", this).hide(); }		
	);
	$(".firstitem .merchBuy").hover (
		function() { $(".merchBuyFlyout", this).show(); },
		function() { $(".merchBuyFlyout", this).hide(); }		
	);
	$(".seconditem .merchBuy").hover (
		function() { $(".merchBuyFlyout", this).show(); },
		function() { $(".merchBuyFlyout", this).hide(); }		
	);
	$(".thirditem .merchBuy").hover (
		function() { $(".merchBuyFlyout", this).show(); },
		function() { $(".merchBuyFlyout", this).hide(); }		
	);
	/* END: Merch module drop-downs */	
	
	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");
		}
	});

   /* Make rel="external" links open in a new window */
    $("a[rel=external]").attr("target", "_new");
    
    /* Fixing the target for the digg link */
    $(".shareweb .digg a").attr("target", "_new");
    
    /* Append labels to elements in discussion module */
    $(".topics li.topic .activity").prepend("Replies: ");
    /* 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");
    
    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-340654  .topic .description img").length;
    for (i = 0; i < noOfImageDscDtl; i++) {
        var discussionImageElement = $("#discussion_listing-340654 .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);
        }
        
    }
	
	// Functionality for add new blogs.
    $(".blog_listing .nav_meta .more a").bind("click", function(e){
		
		$.cookie("blog_body", blogTwitterBlurbText, {
            path: "/"
        });
    });
	    if ($("body").attr("id") == "add_new_blog") {        
        $.cookie("blog_body", blogTwitterBlurbText, {
            path: "/"
        });
    }

	
   
    //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- 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>');
				}
			}			
		});	
		
	/*End - code which obfuscates email addresses #2420*/
	
	var prvteCont="<i class='prText'>&nbsp;&nbsp;</i>";

	$('#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 enlarging photos and videos -START*/


		
});

	function modifyMediaSize(cssSelector,thumbSize,avatarAncStyle,avatarImgStyle,isVideo){
	$(cssSelector).each(function(){
		var photoImageSrc = $(this).attr("src");
		var photoImageSrcNew = "";
		var anchorRef ="";
		if (null != photoImageSrc) {
			var slashpoint = photoImageSrc.lastIndexOf("/");
			var uspoint = photoImageSrc.lastIndexOf("_");
			var dotpoint = photoImageSrc.lastIndexOf(".");
			var srcLength = photoImageSrc.length;			
			var imgPath_1 = photoImageSrc.substring(0, slashpoint);
			var imgPath_2 = photoImageSrc.substring(slashpoint, uspoint);
			var imgPath_3 = photoImageSrc.substring(dotpoint, (srcLength));
			photoImageSrcNew = imgPath_1 + imgPath_2 + thumbSize + imgPath_3;
			$(this).parent().attr("style", avatarAncStyle);
			anchorRef = $(this).parent().attr("href");
			$(this).attr("style", avatarImgStyle);
			var avatarDivStyle = "background:transparent url(" + photoImageSrcNew + ") no-repeat 0px 0px;";
			$(this).attr("src", photoImageSrcNew);
			$(this).parent().parent().attr("style", avatarDivStyle);
			if(isVideo){
				$(this).parent().parent().append("<a class='preplayIcon' "+ "href = '" + anchorRef + "'></a>");
			}
			
			
		}

});
}


function modifyTourModule(){
	$(".event_listing ul.cal_events li").each(function(){		
        var eRawDate = $(this).find(".txt .date h4 a");
		var eRawTitle = $(this).find(".txt .event_title .title").html();
		var eventMLoc=$(this).find(".txt .event_location");
		var eventLoc=$(this).find(".txt .event_location .location");
		$(this).find(".txt .event_location .location").remove();
		var eventVenue=$(this).find(".txt .event_location .venue");
		$(eventLoc).insertBefore(eventVenue);
		
		var eventBuy=$(this).find(".txt .buy");
		$(this).find(".txt .buy").remove();
		$(eventBuy).insertAfter(eventMLoc);
		
        //stores Month and day
        var eMonDateArr = "";
        //Stores Month
        var eMon = "";
        //Stores Day
        var eDate = "";
		
		//$(this).find(".txt .event_location").html(""+$(eventLoc)+$(eventVenue)+"");
        //Splitting comma separated
        if ($(eRawDate).length != 0) {
            var tempArr = (eRawDate).html().split(',');
            eMonDateArr = tempArr[0];
            //Spliting space separated
            var tempMonDateArr = eMonDateArr.split(" ");
            eMon = tempMonDateArr[0];
            eDate = tempMonDateArr[1];
            eMon = eMon.substring(0, 3);
            $(this).find(".txt .date").html('<div class="eventMonth"><a href=" '+eRawDate.attr("href")+' ">' + eMon + '</a></div><div class="eventDay"><a href=" '+eRawDate.attr("href")+' ">' + eDate + '</div>');
			$(this).find(".txt .event_title .title").html('<a href=" ' + eRawDate.attr("href")	 + '">'+ eRawTitle +'</a>');
        }
    });
	
 var viewMoreHtm='<div class="nav_meta"><ul><li class="more"><a href="/tour-dates/">VIEW ALL</a></li></ul></div>';	
 //$('#event_listing-4765876.event_listing .content .body').append(viewMoreHtm);
	
}

function eoscInit(){
	
	$('#discussion_listing-294531 .topics li').each(function(){

var test=$(this).find('.date').text().replace('Last Reply','Last Reply:');
console.log(test);
$(this).find('.txt .date').text(test);
}); 
modifyMediaSize();
modifyTourModule();
$('.event_listing .module .content .body .cal_events li').each(function(){
		var eventLink=$(this).find('.txt .date .eventMonth a').attr('href');
		var eventCity=$(this).find('.txt .event_location .location .city').text();
		var eventRegion=$(this).find('.txt .event_location .location .region').text();
		var eventVenue=$(this).find('.txt .event_location .venue').text();
		$(this).find('.txt ..event_location .location').remove();
		$(this).find('.txt ..event_location .venue').remove();
		var eventLocation='<div class="location"><a class="city" href=' +eventLink+'>'+eventCity+'</a><a class="region" href='+eventLink+'>'+eventRegion+'</a></div>';
		var eventVenueLink='<a class="venue" href=' +eventLink+'>'+eventVenue+'</a>';
		($(this).find('.txt .event_location')).append(eventLocation)
											  .append(eventVenueLink); 
	});
	
	
	
$('.txt .comments').each(function(){
	var and = $(this).text();
	and = and.substring(0, 1);
       if(and != "("){
	    var count = $(this).text();
        count = "(" + count + ")";
        $(this).text(count);
		}
    });
	if (($('.highest_rated')).hasClass('most_rated'))
	{
		$('#video_thumbnail-5640867').css('display','block');
	}
	if (($('#Contestpage .highest_rated')).hasClass('most_rated'))
	{
		$('#video_thumbnail-5645626').css('display','block');
	}
	$('#nav_main-294563 ul li.nav-tour_dates a').attr('href', '/event/');
	
	var prvtLegend='<span class="private">Visible only to site adminstrators</span>';
    $('.edit_account li.input.annotation').append(prvtLegend);

modifyMediaSize(".photo_thumbnail .photos li .img a img","_6","display:block !important;width:161px !important;height: 161px !important;","display:block !important;width:161px !important;height: 161px !important;cursor:pointer !important;",false);
modifyMediaSize(".video_thumbnail .videos li .img a img","_6","display:block !important;width:161px !important;height: 115px !important;","display:block !important;width:161px !important;height: 115px !important;cursor:pointer !important;",true);
modifyMediaSize(".photo_thumnail .photos li .img a img","_6","display:block !important;width:161px !important;height: 161px !important;","display:block !important;width:161px !important;height: 161px !important;cursor:pointer !important;",false);

modifyMediaSize("#video_thumbnail-5572799.video_thumbnail .videos li .img a img","_6","display:block !important;width:220px ;height:158px ;","display:block !important;width:220px ;height:158px ;cursor:pointer !important;",true);
modifyMediaSize("#contest_entries #video_thumbnail-5572799.video_thumbnail .videos li .img a img","_6","display:block !important;width:163px ;height:116px ;","display:block !important;width:163px ;height:116px ;cursor:pointer !important;",true);
modifyMediaSize("#video_thumbnail-5645626.video_thumbnail .videos li .img a img","_6","display:block !important;width:220px ;height:158px ;","display:block !important;width:220px ;height:158px ;cursor:pointer !important;",true);

var viewMore='<div class="nav_meta"><ul><li class="more view_all"><a href="/itgirlcontestvideos/">VIEW ALL</a></li></ul></div>';
if ($('#video_thumbnail-5572799 .nav_meta .view_all').length == 0) {
	$('#video_thumbnail-5572799.video_thumbnail .module .content .body').append(viewMore);
}
if ($('#video_thumbnail-5645626 .nav_meta .view_all').length == 0) {

	$('#video_thumbnail-5645626.video_thumbnail .module .content .body').append(viewMore);
}
$(".module .content .foot").each(function(){
		var footMeta = $(this).find('.nav_meta');
		var footPage = $(this).find('.nav_page');
		$(this).siblings('.body').append(footMeta);
		$(this).siblings('.body').append(footPage);
		});
		


if (!(userEmail)) {
	$('.photo_thumbnail .photos li.category_54681').each(function(){
		var photohref = $(this).find('.img a').attr("href");
		var photoRestriction = '<a class="photoRestrictionImage" href= ' + photohref + ' >photorestriction</a>';
		$(photoRestriction).insertAfter($(this).find('.img a'));
	});
}



	$('#blog_entry-294508.blog_entry .content .foot .nav_blog').insertAfter('#blog_entry-294508.blog_entry .content .body div.article');
	$('.video_thumbnail .module .content .body ul li.video .txt .author').insertAfter('video_thumbnail .module .content .body ul li.video .txt .comments');	
		var commentTitle = $('.comments .content .title.comment');
		commentTitle.insertBefore('.comments .content fieldset');
		$('.comments .content').css('display','block');	


	//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(); 		
	
	/*reset password screen*/	
	$('.reset_password .module .content .body').insertBefore('#errorMsg');	
	
	/* Addition of Fanclub class - remove if there is no fanclub pages in the site  */
	if(fanclubNotifier != null && fanclubNotifier){
	
		$('.photo_thumbnail li.photo').each(function(){
				for (count = 0; count < photoFCCategories.length; count++) {
					$(".photo_thumbnail li." + photoFCCategories[count] + ".photo").addClass("fanClub");
				}
		});
		
		$('.discussion_listing li.topic').each(function(){
				for (count = 0; count < forumFCCategories.length; count++) {
					$(".discussion_listing li." + forumFCCategories[count] + ".topic").addClass("fanClub");
				}
		});
		
		$('.video_thumbnail li.video').each(function(){
				for (count = 0; count < videoFCCategories.length; count++) {
					$(".video_thumbnail li." + videoFCCategories[count] + ".video").addClass("fanClub");
				}
		});
		
		$('.blog_listing li.article').each(function(){
				for (count = 0; count < blogFCCategories.length; count++) {
					$(".blog_listing li." + blogFCCategories[count] + ".article").addClass("fanClub");
				}
		});		
			
	}	
	
	/* Addition of Fanclub class - Ends */	
	 var contestEnabled = true; //This should be giv false if the contest needs to be disabled
	 var contestVideoCategories = new Array("category_56936");
	
		 if(contestEnabled) {
		 	$('.video_thumbnail li.video').each(function(){
					for (count = 0; count < contestVideoCategories.length; count++) {
						$(".video_thumbnail li." + contestVideoCategories[count] + ".video").addClass("contestupload");
					}
			});
		 }
$('.video_thumbnail .videos li.contestupload .img a img').each(function(){
		var anchorRef ="";
		anchorRef = $(this).parent().parent().attr("href");		
	      $(this).parent().parent().append("<a class='preplayIcon' " + "href = '" + anchorRef + "'></a>");
                  
	});
	/* SP Start */
	$(".edit_account #accountData .buttons.input .button.submit input.submit").removeAttr("onclick");
	$(".edit_account #accountQuestoins .buttons.input .button.submit input.submit").removeAttr("onclick");
	
	$('.edit_account #accountData .buttons.input .button.submit input.submit').die();
	$('.edit_account #accountQuestoins .buttons.input .button.submit input.submit').die();
	
	$.wmgfeature.spFeatureEditAccountAccData(".edit_account #accountData .buttons.input .button.submit input.submit", "edit_account-294534", true, arrElementIDs, "http://www.startersite1.wmg.ciscoeos.com", "9752");
	$.wmgfeature.spFeatureEditAccountAccQuestions(".edit_account #accountQuestoins .buttons.input .button.submit input.submit", "edit_account-294534", true, arrElementIDs, "http://www.startersite1.wmg.ciscoeos.com", "9752");
	/* SP End */
	
	/* sold out functionality */
	$('.event_listing ul.cal_events li.cal_event').each(function(){
		var eventPath=  $(this).find('.txt .date a').attr('href');
		var availablity=$(this).find('.availability').text();		
		if(availablity.length > 0 || availablity.toUpperCase()=="SOLD OUT"){
			var availabilitylink='<a class="availabilitylink" href="'+eventPath+'">Sold out</a>';
			$(this).find('.availability').append(availabilitylink);		
			$(this).find('.buy a').attr("href","");
		}
	});
	
	eoscinitCallBack();
		
}


   $.urlParam = function(name){
        var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
        if (results == null) {
            return 0;
        }
        else {
            return results[1];
        }
    }	
	
	
	/* Functions for New Merch.*/

	/*
	 * This function is used to tag store links with different omniture tags, 
	 * to track them. This will enable us to track which links the user clicked. 
	 * 
	 * */
	function getMerchOmnitureArray(omnitureString){
		var omnitureArrayLinks = new Array();
		var omnitureStrRegex = /intcmp=(.*)(&.*|\/)$/;
		omnitureString = $.trim(omnitureString);
		if (omnitureString.charAt(omnitureString.length-1) != "/" ){omnitureString += "/";}
		writeToConsole ("This is the omnitureString " + omnitureString);
		regExCapture = omnitureString.match(omnitureStrRegex);
		//A JSON object could be used and a fuction to populate that could be used. 
		if (regExCapture != null && regExCapture != ""){
			var regularExpCapture = regExCapture[1]; 
			omnitureString = omnitureString.replace(/\/$/,'');
			omnitureArrayLinks["page-title"] = omnitureString.replace(regularExpCapture,regularExpCapture+'-page-title');
			omnitureArrayLinks["page-button"] = omnitureString.replace(regularExpCapture,regularExpCapture+'-page-button');
			omnitureArrayLinks["page-thumb"] = omnitureString.replace(regularExpCapture,regularExpCapture+'-page-thumb');
			omnitureArrayLinks["hovercard-title"] = omnitureString.replace(regularExpCapture,regularExpCapture+'-hovercard-title');
			omnitureArrayLinks["hovercard-thumb"] = omnitureString.replace(regularExpCapture,regularExpCapture+'-hovercard-thumb');
			omnitureArrayLinks["hovercard-button"] = omnitureString.replace(regularExpCapture,regularExpCapture+'-hovercard-button');
		}else{
			omnitureArrayLinks["page-title"] = omnitureString.replace(/\/$/,'?intcmp=page-title');
			omnitureArrayLinks["page-button"] = omnitureString.replace(/\/$/,'?intcmp=page-button');
			omnitureArrayLinks["page-thumb"] = omnitureString.replace(/\/$/,'?intcmp=page-thumb');
			omnitureArrayLinks["hovercard-title"] = omnitureString.replace(/\/$/,'?intcmp=hovercard-title');
			omnitureArrayLinks["hovercard-thumb"] = omnitureString.replace(/\/$/,'?intcmp=hovercard-thumb');
			omnitureArrayLinks["hovercard-button"] = omnitureString.replace(/\/$/,'?intcmp=hovercard-button');
		}				 
		return omnitureArrayLinks;
	}
	
	/*
	 * Function to add the hovercard to the template,
	 * if set in the config xml.
	 * 
	 * */
	function prepareMerchTemplate (merchHoverCardPresent){
		if (merchHoverCardPresent){
			merchModuleTemplate = merchModuleTemplate.replace("<!-- HOVERCARD -->",merchHCTemplate);
		}else{
			merchModuleTemplate = merchModuleTemplate.replace("<!-- HOVERCARD -->","");
		}
		
	}
	
	function getMerchHeader ($merchCountries,merchViewAllLink,positionClass){
		var merchHeaderString = "";
		var merchCountryString = "";
		var countryParams;
		var merchParams = {
							merchViewAllLink : merchViewAllLink,
							positionClass : positionClass};
			$merchCountries.each (function(){

				countryParams = {
					countryName : $(this).children(".countryName").html(),
					countryLink : $(this).children(".countryLink").html(),
					countryText : $(this).children(".countryText").html()
				};
				merchCountryString += merchCountryTemplate.supplant(countryParams);
				
			})

			merchViewAllLink ="javscript:void(0)"; 	
		
		merchHeaderString = merchHeaderTemplate.supplant(merchParams);
		merchHeaderString = merchHeaderString.replace("<!-- MERCH COUNTRIES -->",merchCountryString);
		return merchHeaderString;
	}
	
	/*
	 * This function generates the structure of the merch module. 
	 * The structure is created using templates defined earlier in the page.  
	 */ 
	function generateMerchStructure (){
		var $merchData = $("#merchData");
		var $merchItem = $merchData.children(".merchItems")
		var merchViewAllLink = $merchData.children(".merchViewAll").html();
		var merchHoverCardPresent = $merchData.children(".merchHoverCardPresent").html().trim();
		merchHoverCardPresent = !!merchHoverCardPresent;
		prepareMerchTemplate (merchHoverCardPresent);
		
		/* Code for the Merch Head */
		var merchHead = '<div class="merchHead"><div class="visitStore"><a href="'+ merchViewAllLink +'" class="visitStoreLink"  >ALL</a></div></div>'
		merchHead = getMerchHeader($("#merchInternational .country"),merchViewAllLink,"merchHead");
		var visitStorehead = $('#merchContainer').parent(".description").parent(".body").siblings(".head");
	        $(merchHead).appendTo(visitStorehead);
		$(visitStorehead).find("a").makeLinksExternal();
		/* End of Code for Merch Module */
		
		var merchBody='<ul class="merchItems">';
		$.each($merchItem.children(".merchItem"), function (i){
			var merchBuyNow = $(this).children(".merchBuyNow").html(); 			
			var omnitureLinks = getMerchOmnitureArray(merchBuyNow);
			var merchSizes = $(this).children(".merchSizes").html();
			if (merchSizes !="" && merchSizes !=null){merchSizes = '<h3>Sizes</h3><div>'+merchSizes+'</div>';}
			var merchDesc = $(this).children(".merchDesc").html();
			if (merchDesc != "" && merchDesc != null){merchDesc = '<h3>Description</h3><div>'+ merchDesc +'</div>';}
			var merchParsedData = {
				             index:(i+1),
							 merchImage:$(this).children(".merchImage").html(),
							 merchTitle:$(this).children(".merchTitle").html(),
							 merchDesc:merchDesc,
							 merchSizes:merchSizes,
							 merchPrice:$(this).children(".merchPrice").html(),
							 omnitureLinksPTitle:omnitureLinks["page-title"],
							 omnitureLinksPThumb:omnitureLinks["page-thumb"],
							 omnitureLinksPButton:omnitureLinks["page-button"],
							 omnitureLinksHTitle:omnitureLinks["hovercard-title"],
							 omnitureLinksHThumb:omnitureLinks["hovercard-thumb"],
							 omnitureLinksHButton:omnitureLinks["hovercard-button"]
							 }
			merchBody = merchBody + merchModuleTemplate.supplant(merchParsedData);
		});
		merchBody += '</ul><div class="clear"></div>';
	
		var merchFoot = '<div class="clear"></div><div class="merchFoot"><div class="visitStore"><a href="'+ merchViewAllLink +'" class="visitStoreLink" >View ALL</a></div></div>';
		merchFoot = '<div class="clear"></div>';
		merchFoot += getMerchHeader($("#merchInternational .country"),merchViewAllLink,"merchFoot");
		var visitStoreFoot = $('#merchContainer').parent(".description").parent(".body").siblings(".foot");
	        $(merchFoot).appendTo(visitStoreFoot);
		$(visitStoreFoot).find("a").makeLinksExternal();

		return merchBody;
	}
	
	
	
	/*These functions are used by the merch HC so that casual hovers less than 300 seconds
	 * are omitted. 
	 */
	function bringMerchHCOn(merchImg){
		merchImg.showTimer = window.setTimeout(function(){
			$(merchImg).siblings(".merchHC").fadeIn(300);
		},300);
	}
	function killMerchHC(merchImg){
		if (merchImg.showTimer){
			window.clearTimeout(merchImg.showTimer);
		}
	}
	
	/* Registereing the hover events */
	function registerMerchHoverEvents(){
		$(".merchImg").hover(function(){
			bringMerchHCOn(this);
		},function(){
			killMerchHC(this);
		});
		$(".merchHC").hover(function(){
		},function(){
			$(this).fadeOut(300);
		});
		
		$(".visitStore").hover (
			function() { $(".visitStoreFlyout", this).show(); },
			function() { $(".visitStoreFlyout", this).hide(); }
		);
	}
	
	/* The piece of code which generates the merch, adds the dom and registers the events. */
	
	$(document).ready(function(){
		if ($("#merchContainer").length > 0){
			$("#merchContainer").html(generateMerchStructure());
			$("#merchData").empty();
			$("#merchContainer a").makeLinksExternal();
			//registerMerchHoverEvents();
			//pushes "views" from foot to body in member_detail.html 
			
		}
		$(".obj_meta ul li.views").insertAfter($(".obj_meta ul li.comments"));
		
		
		
		$("#html-327531.html .module .content .foot .merchFoot").insertAfter('#html-327531.html .module .content .body #merchContainer');
		/* international page coding starts */
if (location.href.indexOf("/fr/") != -1) {updateNavBar(fraGlbNav);updateHomePage(fraGlbNav);}
else if (location.href.indexOf("/de/") != -1) {updateNavBar(gerGlbNav);updateHomePage(gerGlbNav);}
else if (location.href.indexOf("/nl/") != -1) {updateNavBar(netGlbNav);updateHomePage(netGlbNav);}





$('#germany_home .articles li').each(function(){
	var blogCommentLink=$(this).find('.activity a.comment').attr('href');
	var blogComment=$(this).find('.activity a.comment').text().trim();
	var blogCommentCount=blogComment.substring(blogComment.lastIndexOf("(")+1,blogComment.lastIndexOf(")"));
	$(this).find('.activity a.comment').remove();
	var germanyblog='<a class="comment" href=' + blogCommentLink +'>Kommentare ('+blogCommentCount+') </a>';
	$(this).find('.activity').append(germanyblog);
});

$('#france_home .articles li').each(function(){
	var blogCommentLink=$(this).find('.activity a.comment').attr('href');
	var blogComment=$(this).find('.activity a.comment').text().trim();
	var blogCommentCount=blogComment.substring(blogComment.lastIndexOf("(")+1,blogComment.lastIndexOf(")"));
	$(this).find('.activity a.comment').remove();
	var germanyblog='<a class="comment" href=' + blogCommentLink +'>Commentaires ('+blogCommentCount+') </a>';
	$(this).find('.activity').append(germanyblog);
});


$('#netherlands_home .articles li').each(function(){
	var blogCommentLink=$(this).find('.activity a.comment').attr('href');
	var blogComment=$(this).find('.activity a.comment').text().trim();
	var blogCommentCount=blogComment.substring(blogComment.lastIndexOf("(")+1,blogComment.lastIndexOf(")"));
	$(this).find('.activity a.comment').remove();
	var germanyblog='<a class="comment" href=' + blogCommentLink +'>Reacties ('+blogCommentCount+') </a>';
	$(this).find('.activity').append(germanyblog);
});

$("body#netherlands_home #html-5119595 .module .content .head h3").text("VIDEO");


		
		
		$("#html-4971269.html .module .content .foot .merchFoot").insertAfter('#html-4971269.html .module .content .body #merchContainer');
		$("#html-4971273.html .module .content .foot .merchFoot").insertAfter('#html-4971273.html .module .content .body #merchContainer');
		$("#html-4971278.html .module .content .foot .merchFoot").insertAfter('#html-4971278.html .module .content .body #merchContainer');
		$("#html-4973602.html .module .content .foot .merchFoot").insertAfter('#html-4973602.html .module .content .body #merchContainer');
		$("#html-4973606.html .module .content .foot .merchFoot").insertAfter('#html-4973606.html .module .content .body #merchContainer');
		
	/* international page coding ends */
	
	
	});
    /* End of Functions for New Merch */
	function updateNavBar(newNavObj){
	if(newNavObj!=null){
		$('body.international .nav_main ul li.nav-home a').text(newNavObj.Home);		
		$('body.international .nav_main ul li.nav-blog a').text(newNavObj.News);
		$('body.international .nav_main ul li.nav-custom.nav-music a').text(newNavObj.Music);
		$('body.international .nav_main ul li.nav-video a').text(newNavObj.Videos);
		$('body.international .nav_main ul li.nav-photo a').text(newNavObj.Photos);
		$('body.international .nav_main ul li.nav-bio a').text(newNavObj.Bio);
		$('body.international .nav_main ul li.nav-event a').each(function(){
			if($(this).text() == "Tour Dates"){			
				$(this).text(newNavObj.Tour_Dates);
			}
		});		
		$('body.international .nav_main ul li.nav-community_landing a').each(function(){			
			if($(this).text() == "Community"){			
				$(this).text(newNavObj.Community);
			}
		});
		$('body.international .nav_main ul li.nav-community_landing ul li#discussionsNav a').text(newNavObj.discussions);
		$('body.international .nav_main ul li.nav-community_landing ul li#communityHomeNav a').text(newNavObj.Community);
		$('body.international .nav_main ul li.nav-event ul li#upcomingNav a').text(newNavObj.upcoming);
		$('body.international .nav_main ul li.nav-event ul li#pastNav a').text(newNavObj.past);
		
		$('body.international .nav_main ul li.nav-custom.nav-store a').each(function(){
			if($(this).text() == "Store"){			
				$(this).text(newNavObj.Store);
			}
		});		
	}	
	}
	
	function updateHomePage(intPageObj){
		$('.song_playlist .module .content .head h3').text(intPageObj.nowplaying);
		$('#event_listing-4765876 .module .content .head h3').text(intPageObj.upcomingShows);
		$('.song_playlist .nav_meta ul li.launchPlayer a').text(intPageObj.launchplayer);
		$('.song_playlist .nav_meta ul li.more a').text(intPageObj.moremusic);
	}		

	



