// JavaScript Document
jQuery(document).ready(function(){
jQuery('#affliateTit').animate({opacity: 0}, 500).hide();								
jQuery('#seeAll').click(function () { 
$('.arrowBtn').show();										 
jQuery('#bolBlk>div').animate({opacity: 1}, 500).show();
jQuery('#affliateTit').animate({opacity: 0}, 500).hide();
jQuery('#affiliates li').removeClass('current');
jQuery('#bolBlk>div').removeClass('filtered');

});

jQuery('#affiliates li').click(function () { 
    
	jQuery('#affiliates li').removeClass('current');
	jQuery(this).addClass('current');
	affliateID = $(this).attr('id');
	jQuery('#affliateTit').show().animate({opacity: 1}, 500);
	switch (affliateID) { 
	
		case 'usa':
		if(jQuery('#bolBlk>div[rel=usa]').length == 1){$('.arrowBtn').hide()}else{$('.arrowBtn').show()};
		jQuery('#bolBlk>div[rel!=usa]').animate({opacity: 0}, 500).hide();
		jQuery('#bolBlk>div[rel=usa]').animate({opacity: 1}, 500).show()
		jQuery('#affliateTit img').attr('src','../Images/BestOfLevis/tit_usa.png');
		jQuery('#bolBlk').find('div[rel!=usa]').removeClass('filtered');
		jQuery('#bolBlk').find('div[rel=usa]').addClass('filtered');		
		break;
		
		case 'canada':
		if(jQuery('#bolBlk>div[rel=canada]').length == 1){$('.arrowBtn').hide()}else{$('.arrowBtn').show()};
		jQuery('#bolBlk>div[rel!=canada]').animate({opacity: 0}, 500).hide();
		jQuery('#bolBlk>div[rel=canada]').animate({opacity: 1}, 500).show();
		jQuery('#affliateTit img').attr('src','../Images/BestOfLevis/tit_canada.png');
		jQuery('#bolBlk').find('div[rel!=canada]').removeClass('filtered');
		jQuery('#bolBlk').find('div[rel=canada]').addClass('filtered');		
		break;
		
		case 'uk':
		if(jQuery('#bolBlk>div[rel=ukireland]').length == 1){$('.arrowBtn').hide()}else{$('.arrowBtn').show()};
		jQuery('#bolBlk>div[rel!=ukireland]').animate({opacity: 0}, 500).hide();
		jQuery('#bolBlk>div[rel=ukireland]').animate({opacity: 1}, 500).show();
		jQuery('#affliateTit img').attr('src','../Images/BestOfLevis/tit_uk.png');
		jQuery('#bolBlk').find('div[rel!=ukireland]').removeClass('filtered');
		jQuery('#bolBlk').find('div[rel=ukireland]').addClass('filtered');
		break;
		
		case 'ireland':
		if(jQuery('#bolBlk>div[rel=ukireland]').length == 1){$('.arrowBtn').hide()}else{$('.arrowBtn').show()};
		jQuery('#bolBlk>div[rel!=ukireland]').animate({opacity: 0}, 500).hide();
		jQuery('#bolBlk>div[rel=ukireland]').animate({opacity: 1}, 500).show();
		jQuery('#affliateTit img').attr('src','../Images/BestOfLevis/tit_ireland.png');
		jQuery('#bolBlk').find('div[rel!=ukireland]').removeClass('filtered');
		jQuery('#bolBlk').find('div[rel=ukireland]').addClass('filtered');
		break;
		
		case 'australia':
		if(jQuery('#bolBlk>div[rel=australia]').length == 1){$('.arrowBtn').hide()}else{$('.arrowBtn').show()};
		jQuery('#bolBlk>div[rel!=australia]').animate({opacity: 0}, 500).hide();
		jQuery('#bolBlk>div[rel=australia]').animate({opacity: 1}, 500).show();
		jQuery('#affliateTit img').attr('src','../Images/BestOfLevis/tit_australia.png');
		jQuery('#bolBlk').find('div[rel!=australia]').removeClass('filtered');
		jQuery('#bolBlk').find('div[rel=australia]').addClass('filtered');
		break;
		
		case 'asiapacific':
		if(jQuery('#bolBlk>div[rel=asiapacific]').length == 1){$('.arrowBtn').hide()}else{$('.arrowBtn').show()};
		jQuery('#bolBlk>div[rel!=asiapacific]').animate({opacity: 0}, 500).hide();
		jQuery('#bolBlk>div[rel=asiapacific]').animate({opacity: 1}, 500).show();
		jQuery('#affliateTit img').attr('src','../Images/BestOfLevis/tit_asiapacific.png');
		jQuery('#bolBlk').find('div[rel!=asiapacific]').removeClass('filtered');
		jQuery('#bolBlk').find('div[rel=asiapacific]').addClass('filtered');		
		break;
		
		case 'southafrica':
		if(jQuery('#bolBlk>div[rel=southafrica]').length == 1){$('.arrowBtn').hide()}else{$('.arrowBtn').show()};
		jQuery('#bolBlk>div[rel!=southafrica]').animate({opacity: 0}, 500).hide();
		jQuery('#bolBlk>div[rel=southafrica]').animate({opacity: 1}, 500).show();
		jQuery('#affliateTit img').attr('src','../Images/BestOfLevis/tit_southafrica.png');
		jQuery('#bolBlk').find('div[rel!=southafrica]').removeClass('filtered');
		jQuery('#bolBlk').find('div[rel=southafrica]').addClass('filtered');		
		break;
		
		case 'japan':
		if(jQuery('#bolBlk>div[rel=japan]').length == 1){$('.arrowBtn').hide()}else{$('.arrowBtn').show()};
		jQuery('#bolBlk>div[rel!=japan]').animate({opacity: 0}, 500).hide();
		jQuery('#bolBlk>div[rel=japan]').animate({opacity: 1}, 500).show();
		jQuery('#affliateTit img').attr('src','../Images/BestOfLevis/tit_japan.png');
		jQuery('#bolBlk').find('div[rel!=japan]').removeClass('filtered');
		jQuery('#bolBlk').find('div[rel=japan]').addClass('filtered');		
		break;
		
		/*case 'other':
		if(jQuery('#bolBlk>div[rel=other]').length == 1){$('.arrowBtn').hide()}else{$('.arrowBtn').show()};
		jQuery('#bolBlk>div[rel!=other]').animate({opacity: 0}, 500).hide();
		jQuery('#bolBlk>div[rel=other]').animate({opacity: 1}, 500).show();
		jQuery('#affliateTit img').attr('src','../Images/BestOfLevis/tit_japan.png');
		jQuery('#bolBlk').find('div[rel!=other]').removeClass('filtered');
		jQuery('#bolBlk').find('div[rel=other]').addClass('filtered');		
		break;*/
		
	}
 });

});



jQuery(document).ready(function(){
$("#popupContainer").animate({opacity: 0}, 500).hide();
//$("#popupContainer").hide();
$("#popup").hide();
$("#popup").css('width','1px');
$("#popup").css('height','1px');
$(".info").click(function () { 
$("#popupContainer").show().animate({opacity: .5}, 500,function() {  
	//$("#popup").show(); 
	$("#popup").animate({width:320+"px",height:340+"px",left:(480-160)+"px",top:(380-170)+"px"},500);
});
});
});


jQuery(document).ready(function(){
	
$('.info').click(function () { 	
	//alert($(this).parent('div').parent('div').attr('rel'));
	$('html, body').animate({scrollTop:100}, 'slow');
	relation = $(this).parent('div').parent('div').attr('id');
	//$('.popupMidContent #head').html('this is test');
	//alert(relation);
	//if(relation == ''){}
	contentChange(relation);
	$('#prev').removeClass();
	$('#prev').addClass(relation);
	$('#next').removeClass();
	$('#next').addClass(relation);
	//CurrentIDNo = $(this).parent('div').parent('div').attr('id').replace(/bol/ig, "");
	//$('#next').attr('onclick','next('+"bol"+','+"on"+',1)');
	
	
});
});


/*function next(currentIdTxt,onoff,currentIdNo)
{
	alert(currentIdNo);
	if(onoff=='on'){
	alert(currentIdNo);
	currentIdNo++;
	//contentChange(currentId);
	contentChange('bol'+currentIdNo);
	}
	else{
		//alert("next");
		
	    }
}*/


function contentChange(relation){
		//alert('hi')
		switch (relation) { 
		case 'bol1':
		$('.popupMidContent #image').attr('src','../Images/BestOfLevis/bol_large_img20.jpg');
		$('.popupMidContent #head').html('The Workers Campaign');
$('.popupMidContent #content').html('Levi&rsquo;s<sup>&reg;</sup> in partnership with IFC and Sundance Channel proudly supports the We Are All Workers campaign. The people of Braddock are unified by hope for renewed prosperity as they work to become a community again. The town&rsquo;s locals and newcomers alike share in optimism for the future, desire for change, and the collective willingness to roll up their sleeves and take on the new work. ');
		$('.popupMidContent #link').attr('href','http://explore.levi.com/news/we-are-all-workers/').css('display','block');
		break;
		
		case 'bol2':
		$('.popupMidContent #image').attr('src','../Images/BestOfLevis/bol_large_img21.jpg');
		$('.popupMidContent #head').html('Welcome to Braddock - The New Frontiers');
$('.popupMidContent #content').html('Braddock, Pennsylvania embodies the new work that is reinvigorating urban areas throughout the country. Here you can explore the streets of Braddock in Google Maps street view, learn more about the community, and discover how you can get involved with the town&rsquo;s rebirth. With support from other pioneering spirits like you, Braddock&rsquo;s own pioneers will have the support and resources they need to continue to create new frontiers');
		$('.popupMidContent #link').attr('href','http://explore.levi.com/news/welcome-to-braddock/').css('display','block');
		break;
		
		case 'bol3':
		$('.popupMidContent #image').attr('src','../Images/BestOfLevis/bol_large_img22.jpg');
		$('.popupMidContent #head').html('Workwear by Pendleton');
$('.popupMidContent #content').html('Levi&rsquo;s<sup>&reg;</sup> announced the launch of the third collection in its Levi&rsquo;s<sup>&reg;</sup> Workwear Collaborations Series; Levi&rsquo;s<sup>&reg;</sup> Workwear by Pendleton. The new collection features the style and denim of Levi&rsquo;s and the authentic wool jacquard fabrics of Pendleton. &rsquo;Made in America&rsquo; is taken to a whole new level with the union of these two brands. Pendleton&rsquo;s Native American-inspired jacquard patterns are a true expression of the American West as is Levi&rsquo;s<sup>&reg;</sup> denim, the chosen uniform of cowboys, ranchers and workers alike.');
		$('.popupMidContent #link').attr('href','http://explore.levi.com/news/collaborations/').css('display','block');
		break;
		
		case 'bol4':
		$('.popupMidContent #image').attr('src','../Images/BestOfLevis/bol_large_img19.jpg');
		$('.popupMidContent #head').html('Levi&rsquo;s<sup>&reg;</sup> Craftwork');
$('.popupMidContent #content').html('A project by Levi&rsquo;s<sup>&reg;</sup> Europe in conjunction with the opening of the brand new Levi&rsquo;s<sup>&reg;</sup> store on Regent Street, called Levi&rsquo;s<sup>&reg;</sup> Craftwork, and as part of the relaunch they&rsquo;re featuring 18 of London&rsquo;s best craftsmen- ranging from singers to directors. These craftworkers get featured on the Levi&rsquo;s<sup>&reg;</sup> website and have a space dedicated in the re-vamped store to showcase photographs of them, shot by renowned photographer Dean Chalkley. Keep checking out website to see whats going on!');
		$('.popupMidContent #link').attr('href','http://leviscraftwork.com/').css('display','block');
		break;
				
		case 'bol5':
		$('.popupMidContent #image').attr('src','../Images/BestOfLevis/bol_large_img1.jpg');
		$('.popupMidContent #head').html('Levi&rsquo;s<sup>&reg;</sup> Ones To Watch<sup>&reg;</sup>');
		$('.popupMidContent #content').html('Jazzing into its 5th year, Levi&rsquo;s<sup>&reg;</sup> Ones To Watch<sup>&reg;</sup> continues to whet your music appetite, with the most talked about new artists sure to make it big. Since launching in 2004, Levi&rsquo;s<sup>&reg;</sup> Ones to Watch<sup>&reg;</sup> has showcased several budding new bands that have gone on to become a rage.');
		$('.popupMidContent #link').attr('href','http://eu.levi.com/en_GB/lotwv2/index.html#news').css('display','block');
		break;
		
		case 'bol6':
		$('.popupMidContent #image').attr('src','../Images/BestOfLevis/bol_large_img2.jpg');
		$('.popupMidContent #head').html('Levi&rsquo;s<sup>&reg;</sup> 501<sup>&reg;</sup>');
		$('.popupMidContent #content').html('Calling all Artists … Here&rsquo;s your own launch-pad to celebrate your self expression. Levi&rsquo;s<sup>&reg;</sup> and Vice have come together again after two successful 501<sup>&reg;</sup> campaigns to find UK&rsquo;s most promising painters, illustrators, designers, sculptors, artists and have their work displayed on major sites throughout London. The only rule is that there are no rules');
		$('.popupMidContent #link').attr('href','http://eu.levi.com/en_GB/viceArt/index.html').css('display','block');
		break;
		
		case 'bol7':
		$('.popupMidContent #image').attr('src','../Images/BestOfLevis/bol_large_img3.jpg');
		$('.popupMidContent #head').html('World AIDS Day');
		$('.popupMidContent #content').html('With over 25 million AIDS-related deaths around the world, the HIV virus is still at large. Levi&rsquo;s<sup>&reg;</sup> has long been a leader in the fight against HIV & AIDS. Play Safe is a new initiative to spread awareness, the fun way. Play the game and get to know more about AIDS.');
		$('.popupMidContent #link').attr('href','http://eu.levi.com/en_GB/playSafe/index.html').css('display','block');
		break;
		
		case 'bol8':
		$('.popupMidContent #image').attr('src','../Images/BestOfLevis/bol_large_img12.jpg');
		$('.popupMidContent #head').html('Levi&rsquo;s<sup>&reg;</sup> Unbuttoned ');
		$('.popupMidContent #content').html('Here&rsquo;s the chance to talk to that one person you&rsquo;ve always had the hots for. Unbutton them in your own unrestricted way, without going red in the face. Tell everyone who you want to get hitched with, and through this community&rsquo;s help, get a real chance to do just that.');
		$('.popupMidContent #link').attr('href','http://unbutton.501.com/index.aspx?leadin=ap_brandsite_main').css('display','block');
		break;
				
	}
		
		}


jQuery(document).ready(function(){

//alert();
for(i=1;i<=$('.articleOuterCont').length;i++)
{	
	id = 'bol'+i;
	$('.articleOuterCont').eq(i-1).attr('id',id);

}

$('#popClose').click(function () {

$("#popup").animate({width:1+"px",height:1+"px",left:480+"px",top:380+"px"},500,function() { 
	$("#popup").hide();
	$("#popupContainer").animate({opacity: 0}, 500).hide(); 
});	
});
$('#next').click(function () {
//alert($(this).attr('class'));
id = $(this).attr('class');
if($('#bolBlk>div:visible').hasClass('filtered'))
{
		if( $('#bolBlk>div.filtered').attr('rel')=='ukireland')
		{
		
			switch (id) { 
			case 'bol5' :
			contentChange('bol6');
			$(this).attr('class','bol6');
			$('#prev').attr('class','bol6');
			break;
			case 'bol6' :
			contentChange('bol7');
			$(this).attr('class','bol7');
			$('#prev').attr('class','bol7');
			break;
			case 'bol7' :
			contentChange('bol5');
			$(this).attr('class','bol5');
			$('#prev').attr('class','bol5');
			break;
			}
		}
		
		if( $('#bolBlk>div.filtered').attr('rel')=='australia')
		{
			switch (id) { 
			case 'bol9' :
			contentChange('bol10');
			$(this).attr('class','bol10');
			$('#prev').attr('class','bol10');
			break;
			case 'bol10' :
			contentChange('bol11');
			$(this).attr('class','bol11');
			$('#prev').attr('class','bol11');
			break;
			case 'bol11' :
			contentChange('bol12');
			$(this).attr('class','bol12');
			$('#prev').attr('class','bol12');
			break;
			case 'bol12' :
			contentChange('bol13');
			$(this).attr('class','bol13');
			$('#prev').attr('class','bol13');
			break;
			case 'bol13' :
			contentChange('bol14');
			$(this).attr('class','bol14');
			$('#prev').attr('class','bol14');
			break;
			case 'bol14' :
			contentChange('bol9');
			$(this).attr('class','bol9');
			$('#prev').attr('class','bol9');
			break;			
			}
			
		}
		
		
	}

else
{
	clas = $(this).attr('class');
	current = clas.replace(/bol/ig,"");
	i = parseInt(current);
	j = parseInt(i)+1;
	if(j==9){j = 1;} //when added increase this to one
	nxt = 'bol' + j;
	//alert(nxt);
	contentChange(nxt);
	//alert(j);
	if(j>=8){//when added increase this to one
	$(this).attr('class','bol0');
	$('#prev').attr('class','bol8');//when added increase this to one
	//contentChange('bol1');
	}
	else{$(this).attr('class','bol'+j)
	$('#prev').attr('class','bol'+j);
	}
}
//alert($(this).attr('class'));
});	

$('#prev').click(function () {
//alert($(this).attr('class'));
id = $(this).attr('class');
if($('#bolBlk>div:visible').hasClass('filtered'))
	{
		if( $('#bolBlk>div.filtered').attr('rel')=='ukireland')
		{
			switch (id) { 
			case 'bol5' :
			contentChange('bol7');
			$(this).attr('class','bol7');
			$('#next').attr('class','bol7');
			break;
			case 'bol6' :
			contentChange('bol5');
			$(this).attr('class','bol5');
			$('#next').attr('class','bol5');
			break;
			case 'bol7' :
			contentChange('bol6');
			$(this).attr('class','bol6');
			$('#next').attr('class','bol5');
			break;
			}			
		}
		
		if( $('#bolBlk>div.filtered').attr('rel')=='australia')
		{
			switch (id) { 
			
			case 'bol9' :
			contentChange('bol14');
			$(this).attr('class','bol13');
			$('#next').attr('class','bol14');
			break;
			case 'bol10' :
			contentChange('bol9');
			$(this).attr('class','bol9');
			$('#next').attr('class','bol9');
			break;
			case 'bol11' :
			contentChange('bol10');
			$(this).attr('class','bol10');
			$('#next').attr('class','bol10');
			break;			
			case 'bol12' :
			contentChange('bol11');
			$(this).attr('class','bol11');
			$('#next').attr('class','bol11');
			break;	
			case 'bol13' :
			contentChange('bol12');
			$(this).attr('class','bol12');
			$('#next').attr('class','bol12');
			break;
			case 'bol14' :
			contentChange('bol9');
			$(this).attr('class','bol9');
			$('#next').attr('class','bol9');
			break;
			}
		}
		
	}
else
{
	clas = $(this).attr('class');
	current = clas.replace(/bol/ig,"");
	i = parseInt(current);
	j = parseInt(i)-1;
	if(j==0){ j = 8;} //when added increase this to one
	nxt = 'bol' + j;
	//alert(nxt);
	contentChange(nxt);
	//alert(j);
	if(j<=1){
	$(this).attr('class','bol9'); //when added increase this to one
	$('#next').attr('class','bol0');
	}
	else{$(this).attr('class','bol'+j);
	$('#next').attr('class','bol'+j);
	}
}

//alert($(this).attr('class'));
});	


jQuery(".articleOuterCont").hover(
      function () {
        
		jQuery(".articleOuterCont").stop().animate({opacity:0.5},250)
		jQuery(this).stop().animate({opacity:1},250)
      }, 
      function () {
        jQuery(".articleOuterCont").stop().animate({opacity:1},250)
      }
);
});




