/*  File: basic.js          *//*  By:   Jeremy Tredway    *//*  Ver:  2008-07-17        *//********************************  the following routines require     jquery.js    jquery.dialog.js    jquery.media.js    jquery.scrollable.js*********************************/// generic open window functionfunction openWindow(win_url, win_name, win_w, win_h) {	var win_para = "left=300,top=150,status=1,scrollbars=1,resizable=1,width="+win_w+",height="+win_h;	newWindow = window.open(win_url,win_name,win_para);	if (newWindow) { newWindow.focus(); }	return false;}// obfuscate address functionfunction obfsMail(s,e,h,d,c) {	//if (e == "" || h == "") { return; }	if (d == "") { d = "com"; }	var x = e + "&#x40;" + h + "&#x2E;" + d;	if (c == "") { c = x; }	var y = "href=\"ma" + "ilto:" + x + "\"";	var z = (s == "") ? ("<a " + y + ">" + c + "</a>") : ("<a class=\"" + s + "\" " + y + ">" + c + "</a>");	return z;	//document.write(z);}// synchronize height function(function($){$.fn.syncHeight=function(settings){var max=0;var browser_id=0;var property=[['min-height','0px'],['height','1%']];if($.browser.msie&&$.browser.version<7){browser_id=1;}$(this).each(function(){$(this).css(property[browser_id][0],property[browser_id][1]);var val=$(this).height();if(val>max){max=val;}});$(this).each(function(){$(this).css(property[browser_id][0],max+'px');});return this;};})(jQuery);// onload routines$(function(){	// initialize left navigation active state	$("#left_nav").find("a").each(function() {		if (location.href.indexOf(this.href) != -1) {			$(this).addClass("active");		}	});	// initialize nts navigation	$(".nts_nav .prev, .nts_nav .next").addClass("visible_nav");	$(".nts_nav").scrollable({size:1,items:".items",horizontal:true});	// synchronize nts text height	//$(".nts_text").syncHeight();	//$(window).resize(function(){ $(".nts_text").syncHeight(); });	// NTS columns are no longer identical; instead, sync the .nts_sync subcontainer (so the 'where to buy' lines up) and then the entire inner marquee height.	//$("#pg_new .nts_sync").syncHeight();	//$(window).resize(function(){ $("#pg_new .nts_sync").syncHeight(); });	$("#pg_new .marquee_md2_inner").syncHeight();	$(window).resize(function(){ $("#pg_new .marquee_md2_inner").syncHeight(); });	// initialize product navigation	$("#product_nav .prev, #product_nav .next").addClass("visible_nav");	$("#product_nav").scrollable({size:4,items:".items",horizontal:true});	$("#product_nav .items").find("a").each(function() {		var product_text = $(this).text();		$(this).attr('title', product_text);		if (location.href.indexOf(this.href) != -1) {			$(this).addClass("active");		}		$(this).hover(			function () {				$("#product_nav_title").text(product_text);			}, 			function () {				$("#product_nav_title").text("");			}		);	});	// initialize view details	$("#view_details").find("a").each(function() {		var view_id = $(this).attr("href");		var view_css = "url("+view_id+")";		$(this).click(function() {			$("#frame_bg_custom").css("backgroundImage",view_css);			return false;		});	});	// initialize overlays	$(".dialog").each(function() {		var auth_href = $(this).attr("href");		$(this).click(function() {			$("#jDialogOverlay").click(function() { $.closeDialog(); });			return false;		});		$(this).createDialog({			addr: auth_href,			center: false,			opacity: 0.7,			bg: "#000"		});	});	// dynamically replace flash elements	$(".flash_static").css({"display":"none"});	$('#flash_container').media(function(el, options) { 		options.caption = false; 		options.height = 555; 		options.width = 747; 		options.src = $(el).attr("rel"); 		options.autoplay = true; 		options.bgColor = "#67010f"; 		options.flashVersion = "8"; 	});	// set external links	$("a[@href^=http]").each(function () {		if(this.href.indexOf(location.hostname) == -1) {			$(this).attr('target', '_blank');		}	});	// initialize our story thumbs	$("#quality_img_thumbs").find("a").each(function() {		var detail_id = $(this).attr("id");		$(this).hover(			function () {				$("#quality_images").addClass(detail_id);			}, 			function () {				$("#quality_images").removeClass(detail_id);			}		);		$(this).click(function() {			return false;		});	});  // Hook up 'enlarge' links:  $(".enlarge").find(".dialog").each(function() {    var auth_href = $(this).attr("href");    $(this).click(function() {   	  olTrack(auth_href);      $("#jDialogOverlay").click(function() { $.closeDialog(); });	  return false;    });    $(this).createDialog({      addr: auth_href,      center: false,      opacity: 0.7,      bg: "#000"    });  });	// initialize obfuscated addresses	$(".obfmail").each(function() {		var $this = $(this);		var params = $this.attr('rel').split(':');		if (params[0] == "email") {			var addr = obfsMail("",params[1],"levi","","");		}		$this.html(addr);	});	// initialize header email form	$("#header_email form").submit(function() {		var form_action = $(this).attr("action");		var temp_email = $("#join_email").val();		var temp_url = form_action+"?em="+temp_email;		openWindow(temp_url,"email_popup",520,550);		return false;	});	// set email form parameters	var DEF_VAL = "enter e-mail";	var email_key = document.getElementById("join_email");	if (email_key.value == "") {		email_key.value = DEF_VAL;	}	$("#join_email").focus(function() {		$("#join_email").attr("value","");	});	$("#join_email").blur(function() {		if (email_key.value == "") {			$("#join_email").attr("value",DEF_VAL);		}	});});function showAuth() {  jQuery('a#authentics_link.dialog').click();}
