
$(document).ready(function() { 

/*$('#form1').jqTransform({imgPath:'/js/jqtransformplugin/img/'});
			$('#form2').jqTransform({imgPath:'/js/jqtransformplugin/img/'});
			$('#form3').jqTransform({imgPath:'/js/jqtransformplugin/img/'});
			$('#form4').jqTransform({imgPath:'/js/jqtransformplugin/img/'});
			$('#form5').jqTransform({imgPath:'/js/jqtransformplugin/img/'});
			$('#form6').jqTransform({imgPath:'/js/jqtransformplugin/img/'});*/

$('#nav, #nav1, #nav2, #nav3, #nav4, #nav5, #specsNav, #specsNav2, #ratesNav, #submitAdForm').live('mouseleave',function(){
$('.specsTopDrop,.takeThis,.ratesDrop,.adTopDrop,.specsTopDrop,.ratesTopDrop,.subAdsTopDrop').hide();
});
// dropdown click events
$('.activeMenu span a').live('click', function(){
$('.specsTopDrop').toggle();
});

$('.activeMenu2 span a').live('click', function(){
$('.takeThis').toggle();
});

$('.ratesActiveMenu span a').live('click', function(){
$('.ratesDrop').toggle();
});

$('.adActiveMenu span a').live('click', function(){
$('.adTopDrop').toggle();
});

$('.subMenuSpecs span a').live('click', function(){
$('.specsTopDrop').toggle();
});


//$('.subMenuSpecs').live('click', function(){
//$('.specsTopDrop').hide();
//});

$('.subMenuRates span a').live('click', function(){
$('.ratesTopDrop').toggle();
});

//$('.subMenuRates').live('click', function(){
//$('.ratesTopDrop').hide();
//});

$('.subMenuAds span a').live('click', function(){
$('.subAdsTopDrop').show();
});

//$('.subMenuAds').live('click', function(){
//$('.subAdsTopDrop').hide();
//});

//homepage rates select click
$('.ratesDrop a').live('click', function(){
$('.ratesDrop').hide();
var url = $(this).attr('href');
window.location = url;
});

// prevent default link action
$('.activeMenu,.activeMenu2, .ratesActiveMenu, .adActiveMenu, .subMenuSpecs, .subMenuAds, .subMenuRates').live('click',function(event){
event.preventDefault();
});

//subpage ad mats dropdown select
$('.subMenuAds li.select').live('click', function(event){
event.preventDefault();
var content = $(this).html();
var search = $(this).attr('rel');
$('.subMenuAds span').html(content);
$('.subAdsTopDrop').hide();
var url = $('.subMenuAds span a').attr('href');
window.location = url;
});

//subpage submit ads go button
$('.subAdGo').live('click', function(event){
event.preventDefault();
var url = $('.subMenuAds span a').attr('href');
window.location = url;
});

//subpage rates dropdown select
$('.subMenuRates li.select').live('click', function(event){
event.preventDefault();
var content = $(this).html();
var search = $(this).attr('rel');
$('.subMenuRates span').html(content);
$('.ratesTopDrop').hide();
var url = $('.subMenuRates span a').attr('href');
window.location = url;
});
//subpage rates go button
$('.subPageRatesGo').live('click', function(event){
event.preventDefault();
var url = $('.subMenuRates span a').attr('href');
window.location = url;
});

//subpage specs dropdown select
$('.subMenuSpecs li.select').live('click', function(event){
event.preventDefault();
var content = $(this).html();
var search = $(this).attr('rel');
$('.subMenuSpecs span').html(content);
$('.specsTopDrop').hide();
var url = $('.subMenuSpecs span a').attr('href');
window.location = url;
});
//subpage specs go button
$('.subMenuSpecsGo').live('click', function(event){
event.preventDefault();
var url = $('.subMenuSpecs span a').attr('href');
window.location = url;
});

//submit ads dropdown select
$('.adActiveMenu li.select').live('click', function(event){
event.preventDefault();
var content = $(this).html();
var search = $(this).attr('rel');
$('.adActiveMenu span').html(content);
$('.adTopDrop').hide();
var url = $('.adActiveMenu span a').attr('href');
window.location = url;
});

//submit ads go button
$('.adSpotGo').live('click', function(event){
event.preventDefault();
var url = $('.adActiveMenu span a').attr('href');
window.location = url;
});

// top menu for homepage specs
$('.activeMenu li.select').live('click', function(event){
event.preventDefault();
var content = $(this).html();
var search = $(this).attr('rel');
$('.activeMenu span').html(content);
$('.specsTopDrop').hide();
$.post("/mediakit/ajax/specsSubSection",
				{ search: search },
					function(data){
					var newContent = (data);
					$('#specsNav2 li ul.takeThis').html(newContent);
					$('#specsNav2').css({opacity: "1"});
					var refresh = "- Select a Section";
					$('#specsNav2 span a').html(refresh);
					});
});
// lower menu for homepage specs
$('.activeMenu2 li.select').live('click', function(event){
event.preventDefault();
var content = $(this).html();
var search = $(this).attr('rel');
$('.activeMenu2 span').html(content);
$('.takeThis').hide();
var direct = "/mediakit/specs/";
var seg1 = $('#specsNav li span a').attr('rel');
var seg2 = $('#specsNav2 li span a').attr('rel');
var url = direct + seg1 + "/" + seg2;
window.location = url;
});

// submit button for homepage specs
$('.redirectSpecs').live('click', function(event){
event.preventDefault();
var direct = "/mediakit/specs/";
var seg1 = $('#specsNav li span a').attr('rel');
var seg2 = $('#specsNav2 li span a').attr('rel');
var url = direct + seg1 + "/" + seg2;
window.location = url;
});


/*specs select dropdown #1
$("select.specsSection").change(function(){
var section = $(this).val();
if ( section == "Newspaper" ) {
$('.control').not('.subSectionNewspaper').hide();
$('.subSectionNewspaper').show();
}
if ( section == "T-Magazine" ) {
$('.control').not('.subSectionTmagazine').hide();
$('.subSectionTmagazine').show();
}
if ( section == "Sunday Magazine" ) {
$('.control').not('.subSectionSundayMag').hide();
$('.subSectionSundayMag').show();
}
if ( section == "Online" ) {
$('.control').not('.subSectionOnline').hide();
$('.subSectionOnline').show();
}
if ( section == "Mobile" ) {
$('.control').not('.subSectionMobile').hide();
$('.subSectionMobile').show();
}
if ( section == "Tablet" ) {
$('.control').not('.subSectionTablet').hide();
$('.subSectionTablet').show();
}
});
//end specs select dropdown #1 */

// rates select dropdown #3
$("select.ratesSelect").change(function(){
var entryTitle = $(this).val();
$.post("/mediakit/ajax/ratesEntryId",
				{ entryTitle: entryTitle },
					function(data){
					var entryId = (data);
					var url = entryId ;
					window.location = url;
					});

});

$('.getRates').live('click', function(event){
event.preventDefault();
var entryTitle = $('select.ratesSelectSub').val();
$.post("/mediakit/ajax/ratesEntryId",
				{ entryTitle: entryTitle },
					function(data){
					var entryId = (data);
					var url = entryId ;
					window.location = url;
					});
});
/*end specs select dropdown #2 

$('#specsProcess').live('click', function(){
var section = $('select.specsSection').val();
if ( section == "Newspaper" ) {
var section = "newspaper"
var active = ".subSectionNewspaper"
}
if ( section == "T-Magazine" ) {
var section = "t-magazine"
var active = ".subSectionTmagazine"
}
if ( section == "Sunday Magazine" ) {
var section = "sunday-magazine"
var active = ".subSectionSundayMag"
}
if ( section == "Online" ) {
var section = "online"
var active = ".subSectionOnline"
}
if ( section == "Mobile" ) {
var section = "mobile"
var active = ".subSectionMobile"
}
if ( section == "Tablet" ) {
var section = "tablet"
var active = ".subSectionTablet"
}

var entryTitle = $(active + ' select.specsSubSection').val();
$.post("/ajax/specsEntryId",
				{ entryTitle: entryTitle },
					function(data){
					var urlTitle = (data);
					var url = "/specs/" + section + "/" + urlTitle ;
					window.location = url;
					});
});
// specs page tabbed area */
$('.specNav ul li a').click(function(event){
			event.preventDefault();
			$(this).addClass('tab-active');
			$('.specNav ul li a').not(this).removeClass('tab-active');
  			var scope = $(this).attr('rel');
  			var target = $(scope);
  			$(target).show();
  			$('.specContent li.handle').not(target).hide().not(target).removeClass('tabContentActive');
});

// tabbed areas, global
		$(".tabs ul li a").click(function(event) {
			event.preventDefault();
			$(this).addClass('pager-active');
  			$(".tabs ul li a").not(this).removeClass('pager-active');
  			var scope = $(this).attr('rel');
  			var target = $(scope);
  			$(target).slideDown();
  			$('.tabsContent li.handle').not(target).slideUp().not(target).removeClass('tabContentActive');
	});
}); 

