/**
*------------------------------------------------------------------------------------------+
* COMPANY: Raven Developers 2010
+------------------------------------------------------------------------------------------+
* FILE INFO: Site wide Java Script functions
+------------------------------------------------------------------------------------------+
* WEBSITE: http://www.ravendevelopers.com
+------------------------------------------------------------------------------------------+
* Portions created by Anirudh K. Mahant are Copyright of Raven Developers (C) 2010.
+------------------------------------------------------------------------------------------+
* COPYRIGHT:
* The original author(s) retain all the copyrights of this file including portions created by
* other community developers.
* Portions created by Anirudh K. Mahant are Copyright of Raven Developers (C) 2010.
* Portions contain other jQuery Plugins developed by community members, repective of their own Copyrights & Licensing.
+-------------------------------------------------------------------------------------------+
*/

/**
 * jQuery-Plugin "pngFix"
 * Version: 1.1, 11.09.2007
 * by Andreas Eberhard, andreas.eberhard@gmail.com http://jquery.andreaseberhard.de/
 **/
(function($){jQuery.fn.pngFix=function(settings){settings=jQuery.extend({blankgif:"blank.gif"},settings);var ie55=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1);var ie6=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1);if(jQuery.browser.msie&&(ie55||ie6)){jQuery(this).find("img[src$=.png]").each(function(){jQuery(this).attr("width",jQuery(this).width());jQuery(this).attr("height",jQuery(this).height());var prevStyle="";var strNewHTML="";var imgId=(jQuery(this).attr("id"))?'id="'+jQuery(this).attr("id")+'" ':"";var imgClass=(jQuery(this).attr("class"))?'class="'+jQuery(this).attr("class")+'" ':"";var imgTitle=(jQuery(this).attr("title"))?'title="'+jQuery(this).attr("title")+'" ':"";var imgAlt=(jQuery(this).attr("alt"))?'alt="'+jQuery(this).attr("alt")+'" ':"";var imgAlign=(jQuery(this).attr("align"))?"float:"+jQuery(this).attr("align")+";":"";var imgHand=(jQuery(this).parent().attr("href"))?"cursor:hand;":"";if(this.style.border){prevStyle+="border:"+this.style.border+";";this.style.border="";}if(this.style.padding){prevStyle+="padding:"+this.style.padding+";";this.style.padding="";}if(this.style.margin){prevStyle+="margin:"+this.style.margin+";";this.style.margin="";}var imgStyle=(this.style.cssText);strNewHTML+="<span "+imgId+imgClass+imgTitle+imgAlt;strNewHTML+='style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;strNewHTML+="width:"+jQuery(this).width()+"px;"+"height:"+jQuery(this).height()+"px;";strNewHTML+="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"+"(src='"+jQuery(this).attr("src")+"', sizingMethod='scale');";strNewHTML+=imgStyle+'"></span>';if(prevStyle!=""){strNewHTML='<span style="position:relative;display:inline-block;'+prevStyle+imgHand+"width:"+jQuery(this).width()+"px;"+"height:"+jQuery(this).height()+"px;"+'">'+strNewHTML+"</span>";}jQuery(this).hide();jQuery(this).after(strNewHTML);});jQuery(this).find("*").each(function(){var bgIMG=jQuery(this).css("background-image");if(bgIMG.indexOf(".png")!=-1){var iebg=bgIMG.split('url("')[1].split('")')[0];jQuery(this).css("background-image","none");jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+iebg+"',sizingMethod='scale')";}});jQuery(this).find("input[src$=.png]").each(function(){var bgIMG=jQuery(this).attr("src");jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader"+"(src='"+bgIMG+"', sizingMethod='scale');";jQuery(this).attr("src",settings.blankgif);});}return jQuery;};})(jQuery);
/**
 * CSS Selectors for browser specific CSS
 **/
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);
/**
 * Custom Functions
 * Version: 1.0, 15.02.2010
 * by Anirudh K. Mahant, anithegregorian@hotmail.com http://www.ravendevelopers.com/
 **/
function URLDecode(psEncodeString){var lsRegExp=/\+/g;return unescape(String(psEncodeString).replace(lsRegExp," "));}function ZebraTables(){theTable=jQuery.find("table.zeetable");jQuery(theTable).each(function(i){if(this){jQuery(this).find("tr").each(function(i){var zclass=(i%2==0)?"odd":"even";jQuery(this).addClass(zclass);});}});}function ZebraUL(){theUL=jQuery(document).find("ul.zeeul");jQuery(theUL).each(function(i){if(this){jQuery(this).find("li").each(function(i){var zclass=(i%2==0)?"odd":"even";jQuery(this).addClass(zclass);});}});}function BlurFocusText(){theText=jQuery("input.blur-focus");jQuery(theText).each(function(i){if(this){jQuery(this).blur(function(){if(this.value==""){this.value=this.defaultValue;}});jQuery(this).focus(function(){if(this.value==this.defaultValue){this.value="";}});}});}
/**
 * Equal Heights Functions
 * Version: 1.0, 15.02.2010
 * by Anirudh K. Mahant, anithegregorian@hotmail.com http://www.ravendevelopers.com/
 **/
function equalHeight(group) {
  var tallest = 0;
  group.each(function() {
    var thisHeight = jQuery(this).height();
      if(thisHeight > tallest) {
          tallest = thisHeight;
      }
  });
  group.height(tallest);
}
/**
 * Get Youtube Thumbnail Function
 * Version: 1.0, 15.02.2010
 * by Anirudh K. Mahant, anithegregorian@hotmail.com http://www.ravendevelopers.com/
 **/
function getytThumb(url, size){
  if(url === null){ return ""; }
  size = (size === null) ? "big" : size;
  var vid;
  var results;
  results = url.match("[\\?&]v=([^&#]*)");
  vid = ( results === null ) ? url : results[1];
  if(size == "small"){
    return "http://img.youtube.com/vi/"+vid+"/2.jpg";
  }else {
    return "http://img.youtube.com/vi/"+vid+"/0.jpg";
  }
}
/**
 * Site specific global application of JS code goes here
 * Version: XXXX
 * by Anirudh K. Mahant, anithegregorian@hotmail.com http://www.ravendevelopers.com/
 **/
jQuery(document).ready(function(){
	//-- ZebraUL, ZebraTables and BlurFocusText
	ZebraTables();ZebraUL();BlurFocusText();
	//-- Tab Maker
	jQuery(function(){
		var tabContainers=jQuery("div.tabs > div");
		jQuery("div.tabs ul.tabNavigation a").click(function(){
			tabContainers.hide().filter(this.hash).fadeIn("slow");
			jQuery("div.tabs ul.tabNavigation a").removeClass("selected");
			jQuery(this).addClass("selected");
			return false;
		}).filter(":first").click();
	});
	//-- W3C safe open in new window fix
  jQuery("a[rel=external]").each(
    function(){
      if(this.href.indexOf(location.hostname) == -1) {
        jQuery(this).attr('target', '_blank');
      }
    }
  )
	//-- Equal height
  equalHeight(jQuery(".col-center, .sidebar-wrapper"));
  //--Nudge effect
  jQuery(".nudge a").hover(function(){
    jQuery(this).stop().animate({ paddingLeft: '8px'}, 200);
  }, function() {
    jQuery(this).stop().animate({ paddingLeft: '0px'}, 200);
  });
  //--Fade in out effect
  jQuery(".fader a").hover(
      function(){
        jQuery(this).stop().animate({ marginTop: "-5px" }, 200);
      },
      function(){
        jQuery(this).stop().animate({ marginTop: "0px" }, 300);
      }
    );
});