Template = new Object();

Template.is_safari = (document.childNodes)&&(!document.all)&&(!navigator.taintEnabled)&&(!navigator.accentColorName)?true:false;
Template.is_ie55 = (document.all && document.fireEvent && !document.createComment);
Template.win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);

$(document).ready(function() {
 //externalLinks();
 replaceHrTag();
 styleSecondCol();
 // only make the next call if you have called the lightbox code before you call this functions file
 if($(".lightbox").length > 0)
 $(".lightbox").prettyPhoto();
 
 $('a[@rel="external"]').click( function() {
	window.open( $(this).attr('href') );
	return false;
 })
	
 $('a[@href$=".pdf"]').click( function() {
	window.open( $(this).attr('href') );
	return false;
 })
 
 $('.gallerybox').each( function(index) {
 	var $alttag = $(this).find('.gallerycaption .clienteditor-html').html();
	$(this).find('.galleryimage img').attr({alt:$alttag});
 })
 
});



function replaceHrTag(){	
	$("#primarycontainer hr").wrap("<div class='divider2'></div>");
	$("#sidenavcontainer hr").wrap("<div class='divider2'></div>");
	$("#fullcontainer hr").wrap("<div class='divider2'></div>"); 
	$("#gallerycontainer hr").wrap("<div class='divider3'></div>"); 
	$("#secondarycontent hr").wrap("<div class='divider4'></div>");  
}

// must include table plugin to use this function
function StripeTable(){				
	$(".stripeMe tr").mouseover(function() {$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});
	$(".stripeMe tr:even").addClass("alt");  
}


function styleSecondCol() {
	
    $('tr').each(function(){
						  
		var count=1;
      
    		$('td').each(function(){
      			count++;
				//alert(count);
				if(count%2 != 0){ 
					$(this).addClass("txtright");
				}
    	})
    })
  }
  
  
  
var player = null;
function playerReady(thePlayer) {
	player = window.document[thePlayer.id];
}


function createPlayer() {
	var flashvars = {
		file:"/images/video.flv", 
		autostart:"false"
	}

	var params = {
		allowfullscreen:"true", 
		allowscriptaccess:"always"
	}

	var attributes = {
		id:"player1",  
		name:"player1"
	}

	swfobject.embedSWF("/js/mediaplayer/player.swf", "flashcontent", "223", "184", "9.0.115", false, flashvars, params, attributes);
}