/*
	JavaScript: bundle
	Version: 	1.0
	Date		2009-10-05 
	Author:		elementalblend.com (brandon burkett)
	
	Desc:		This class combines the minified versions of teh following: blend_png, blend_link, blend_table.
				It is ideal to put code in here that is small to begin with and will be used throughout the site.
				Original files should still be included on the server and if edits are made to them, update this
				file with new minified versions.
				
	Note:		Class may be custom per site, added to or removed from.
*/
/* blend_png */
var png={spacerGif:'media/contentImages/blank.gif',ieAlpha:function(img)
{if(img.oldSrc)
{img.src=img.oldSrc;}
img.style.width=img.offsetWidth+'px';img.style.height=img.offsetHeight+'px';img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img.src+"', sizingMethod='scale')";img.oldSrc=img.src;img.src=png.spacerGif;},init:function()
{if(document.all&&!window.opera&&!window.XDomainRequest)
{$('img').each(function(i,img)
{if(img.src.match('.png'))
{img.origWidth=img.offsetWidth;img.origHeight=img.offsetHeight;png.ieAlpha(img);}});}}}
$(document).ready(function(){png.init();});

/* blend_link */
var link={init:function()
{$('a.newWindow').attr('target','_blank');$('.deleteAlert').bind('click',function(){return confirm('Are you sure you want to delete this item?');});}}
$(document).ready(function(){link.init();});

/* blend_table */
var table={sortableClass:['sortableTable'],fixRowClass:function(jqObject)
{jqObject.children('tbody').children('tr:even').attr('class','tableRow');jqObject.children('tbody').children('tr:odd').attr('class','tableRowAlt');},init:function()
{$.each(table.sortableClass,function(i,val)
{$('.'+val).tablesorter({textExtraction:function(node)
{var nodeValue='';if(node.childNodes[0]!=undefined)
{if(node.childNodes[0].innerHTML!=undefined)
{nodeValue=node.childNodes[0].innerHTML;}
else
{nodeValue=node.innerHTML;}}
return nodeValue;}}).bind("sortEnd",function()
{table.fixRowClass($(this));});});}}
$(document).ready(function(){table.init()});

/* blend_resource */
var resource={show:function(jqObject)
{if(forms)
{forms.clearData();}
if(jqObject.val()=='doc')
{resource.hide();$('#docResource').show();$('#docResource label').each(function()
{var html=$(this).html().replace(/<[eE][mM]\sclass\=(inputOptional|"inputOptional")>optional<\/[eE][mM]>/,'');$(this).html(html);});}
else if(jqObject.val()=='link')
{resource.hide();$('#linkResource').show();$('#linkResource label').each(function()
{var html=$(this).html().replace(/<[eE][mM]\sclass\=(inputOptional|"inputOptional")>optional<\/[eE][mM]>/,'');$(this).html(html);});}
else
{resource.hide();}
if(forms)
{forms.rebuildFormData();}},hide:function()
{$('#docResource').hide();$('#linkResource').hide();$('#docResource label, #linkResource label').each(function()
{var html=$(this).html().replace(/<[eE][mM]\sclass\=(inputOptional|"inputOptional")>optional<\/[eE][mM]>/,'');$(this).html(html+' <em class="inputOptional">optional</em>');});},init:function()
{$('#resourceType').bind('change',function(){resource.show($(this));});}}
$(document).ready(function(){resource.init();});