$(document).ready(function() {
						   
var path = window.location.pathname;
var page = path.substring(path.lastIndexOf("/") + 1);
if(page=="MessageBoard.asp")
{
txtVal = "View Response"
}
else
{
txtVal = "View Answer"
}
						   
	$('ul#faqList li a.viewAnswer').click(function(e){
         e.preventDefault();
        if($(this).parent('li').hasClass('active')){
    				$('ul#faqList li.active div.answerContent').hide(500);
    				$('ul#faqList li.active a.viewAnswer').html(txtVal);
    				$('ul#faqList li.active').removeClass('active');        
        }else{
      		if($('ul#faqList li.active').length!='0'){
    				$('ul#faqList li.active div.answerContent').hide(500);
    				$('ul#faqList li.active a.viewAnswer').html(txtVal);
    				$('ul#faqList li.active').removeClass('active');
    			}
          $(this).parent('li').addClass('active');
    			$(this).html('Close');
          $(this).parent('li').children('div.answerContent').show(500);
        }
	});
	
	
	
	

	$('div#ncMap a.city').click(function(){
		var id = $(this).attr('id');
		$('div#splashContent').html($('div#ncMapDetails div#'+id+'_content').html());
		$('div#splashContent').fadeIn(500);
		$('div#splashContent a.mapDetailsClose').click(function(){
			$(this).parent('div').fadeOut(500);
		});
	});
	
	$('ul#travelsList li a.openLink').mouseover(function(){
		$('ul#travelsList li.active').removeClass('active');
		$(this).parent('li').addClass('active');	
		var id = $(this).attr('id');
		var offset = $('ul#travelsList').offset();
		$('div#travelSplash').css({'top': (offset.top+30)+'px', 'left' : (offset.left+60)+'px'});
		$('div#travelSplash div#travelSplashContent').html($('div#'+id+'_content').html());
		$('div#travelSplash').fadeIn(500);
		$('div#travelSplash a.splashClose').click(function(){
			$(this).parent('div').fadeOut(500);	
		});
	});


	$('div#worldMap div.country a.flag').click(function(e){
		if($('a.flag.invisible').length > 0){
      $('div.countryInfo').slideUp(100);
			$('div#worldMap div.country a.flag.invisible').removeClass('invisible');
			$('div#worldMap div.country a.flag').animate({opacity: 1}, 300);
    }
		var offset = $(this).offset();
		$(this).parent('div.country').children('div.countryInfo').fadeIn(500);	
		$('div#worldMap div.country a.flag').addClass('invisible');
		$(this).removeClass('invisible');
		$('div#worldMap div.country a.flag.invisible').animate({opacity: 0.1}, 300);
		$(this).parent('div.country').children('div.countryInfo').children('a.close').click(function(){
			$(this).parent('div.countryInfo').slideUp(200);	
			$('div#worldMap div.country a.flag').removeClass('invisible');
			$('div#worldMap div.country a.flag').animate({opacity: 1}, 300);
		});
	});
	
	
	$('div#cMap div.city a.flag').mouseover(function(e){
		if($('a.flag.invisible').length > 0){
      $('div.cityInfo').slideUp(100);
			$('div#cMap div.city a.flag.invisible').removeClass('invisible');
			$('div#cMap div.city a.flag').animate({opacity: 1}, 300);
    }
		$(this).parent('div.city').children('div.cityInfo').css({position: 'absolute', top: '0px', left: '-470px'});
		$(this).parent('div.city').children('div.cityInfo').fadeIn(500);	
		$('div#cMap div.city a.flag').addClass('invisible');
		$(this).removeClass('invisible');
		$('div#cMap div.city a.flag.invisible').animate({opacity: 0.1}, 300);
		$(this).parent('div.city').children('div.cityInfo').children('a.close').click(function(){
			$(this).parent('div.cityInfo').slideUp(200);	
			$('div#cMap div.city a.flag').removeClass('invisible');
			$('div#cMap div.city a.flag').animate({opacity: 1}, 300);
		});
	});

	
	//$('ul#novelList li ul.purchase').hover(function(){
	//	$(this).addClass('active');	
	//	$(this).children('li.store').fadeIn(500);
	//	$('ul#novelList li ul.purchase.active').css({'z-index' : 99999});
	//}, function(){
	//	$(this).children('li.store').fadeOut(200);		
	//	$(this).removeClass('active');
	//});
	
});

function iframeOpacity(){
  var theframes = document.getElementsByTagName('iframe');
  for(var i = 0; i < theframes.length; i++)
  {
  theframes[i].setAttribute("allowTransparency","true");
  }
}