	$(document).ready(function(){   
		$(".pngfix").pngfix();
		try { 
			document.execCommand('BackgroundImageCache', false, true); 
		}catch(e) {}
		}
	);

	function PopupCenter(pageURL, title,w,h) {
		var left = (screen.width/2)-(w/2);
		var top = (screen.height/2)-(h/2);
		var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
		return false;
	}	
		
	function getParameterByName( name ,url ){
	  if(url == undefined)url = window.location.href;
	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  var regexS = "[\\?&]"+name+"=([^&#]*)";
	  var regex = new RegExp( regexS );
	  var results = regex.exec( url );
	  if( results == null )
		return "";
	  else
		return results[1];
	}

	
	function addToFavoritesJS(strURL,strTitle){
		if (window.sidebar) { //firefox
			window.sidebar.addPanel(strTitle, strURL,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( strURL, strTitle); }
		else if(window.opera && window.print) { // Opera Hotlist
			return true; 
		}
	}	

	function addSocialBookmark(strService,strURL,strTitle){
		if(strURL == undefined ||strURL == "") strURL = location.href;
		if(strTitle == undefined || strTitle == "") strTitle = document.title;
		
		oTitle = strTitle;
		oURL = strURL;
		strURL=encodeURIComponent(strURL);
		strTitle=encodeURIComponent(strTitle);
		
		var isAddBookmark = false;
		switch(strService){
			case "delicious":
				strURL = "http://del.icio.us/post?url="+ strURL +"&title="+ strTitle;
				break;
			case "digg":
				strURL = "http://digg.com/submit?phase=2&url=" + strURL +"&title="+ strTitle;
				break;
			case "furl":
				strURL = "http://www.furl.net/store?s=f&to=0&u=" + strURL +"&ti="+ strTitle;
				break;
			case "newsvine":
				strURL = "http://www.newsvine.com/_tools/seed&save?u="+ strURL +"&T="+ strTitle;
				break;
			case "squidoo":
				strURL = "http://www.squidoo.com/lensmaster/bookmark?" + strURL +"&title="+ strTitle;
				break;			
			case "live":
				strURL = "https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url="+ strURL +"&title="+ strTitle +"&top=1";
				break;
			case "yahoo":
				strURL = "http://myweb.yahoo.com/myresults/bookmarklet?u="+ strURL +"&t="+ strTitle +"&ei=UTF";
				break;
			case "ask":
				strURL = "http://myjeeves.ask.com/mysearch/BookmarkIt?v=1.2&t=webpages&url="+ strURL +"&title="+ strTitle +"&ei=UTF";
				break;
			case "google":
				strURL = "http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+ strURL +"&title="+ strTitle;
				break;
			case "facebook":
				strURL = "http://www.facebook.com/sharer.php?u="+ strURL +"&t="+ strTitle;
				break;	
			case "technorati":
				strURL = "http://technorati.com/faves?add="+ strURL +"&tag="+ strTitle;
				break;	
			case "blogmarks":
				strURL = "http://blogmarks.net/my/new.php?mini=1&simple=1&url="+ strURL +"&content=&public-tags=&title="+ strTitle;
				break;
			case "twitter":
				strURL = "http://twitter.com/home?status="+ strURL;
				break;
			default:			
				isAddBookmark = true;
				addToFavoritesJS(oURL,oTitle);																						
		}
		
		if(!isAddBookmark){
			window.open(strURL);
		}
	}
	

	
(function($) {
	$.extend($.fx.step,{
		backgroundPosition: function(fx) {
			if (fx.state === 0 && typeof fx.end == 'string') {
				var start = $.curCSS(fx.elem,'backgroundPosition');
				start = toArray(start);
				fx.start = [start[0],start[2]];
				var end = toArray(fx.end);
				fx.end = [end[0],end[2]];
				fx.unit = [end[1],end[3]];
			}
			var nowPosX = [];
			nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
			nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
			fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

		   function toArray(strg){
			   strg = strg.replace(/left|top/g,'0px');
			   strg = strg.replace(/right|bottom/g,'100%');
			   strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
			   var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
			   return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
		   }
		}
	});
})(jQuery);	
/**
 * jQuery (PNG Fix) v1.2
 * Microsoft Internet Explorer 24bit PNG Fix
 *
 * The MIT License
 * 
 * Copyright (c) 2007 Paul Campbell (pauljamescampbell.co.uk)
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * @param		Object
 * @return		Array
 */
(function($) {
	
	$.fn.pngfix = function(options) {

		// Review the Microsoft IE developer library for AlphaImageLoader reference 
		// http://msdn2.microsoft.com/en-us/library/ms532969(VS.85).aspx
		
		// ECMA scope fix
		var elements 	= this;
		var settings 	= $.extend({
			imageFixSrc: 	false,
			sizingMethod: 	false 
		}, options);
		
		if(!$.browser.msie || ($.browser.msie &&  $.browser.version >= 7)) {
			return(elements);
		}

		function setFilter(el, path, mode) {
			var fs = el.attr("filters");
			var alpha = "DXImageTransform.Microsoft.AlphaImageLoader";
			if (fs[alpha]) {
				fs[alpha].enabled = true;
				fs[alpha].src = path; 
				fs[alpha].sizingMethod = mode;
			} else {
				el.css("filter", 'progid:' + alpha + '(enabled="true", sizingMethod="' + mode + '", src="' + path + '")');			
			}
		}
		
		function setDOMElementWidth(el) {
			if(el.css("width") == "auto" & el.css("height") == "auto") {
				el.css("width", el.attr("offsetWidth") + "px");
			}
		}

		return(
			elements.each(function() {
				
				// Scope
				var el = $(this);
				
				if(el.attr("tagName").toUpperCase() == "IMG" && (/\.png/i).test(el.attr("src"))) {
					if(!settings.imageFixSrc) {						
						// Wrap the <img> in a <span> then apply style/filters, 
						// removing the <img> tag from the final render 
						el.wrap("<span></span>");
						var par = el.parent();
						par.css({
							height: 	el.height(),
							width: 		el.width(),
							display: 	"inline-block"
						});
						setFilter(par, el.attr("src"), "scale");
						el.remove();
					} else if((/\.gif/i).test(settings.imageFixSrc)) {
						
						// Replace the current image with a transparent GIF
						// and apply the filter to the background of the 
						// <img> tag (not the preferred route)
						setDOMElementWidth(el);
						setFilter(el, el.attr("src"), "image");
						el.attr("src", settings.imageFixSrc);
					}
					
				} else {
					var bg = new String(el.css("backgroundImage"));					
					var matches = bg.match(/^url\("(.*)"\)$/);
					if(matches && matches.length) {						
						// Elements with a PNG as a backgroundImage have the
						// filter applied with a sizing method relevant to the 
						// background repeat type
						setDOMElementWidth(el);
						el.css("backgroundImage", "none");
						
						// Restrict scaling methods to valid MSDN defintions (or one custom)
						var sc = "crop";
						if(settings.sizingMethod) {
							sc = settings.sizingMethod;
						} 
						setFilter(el, matches[1], sc);
						
						// Fix IE peek-a-boo bug for internal links
						// within that DOM element
						el.find("a").each(function() {
							$(this).css("position", "relative");
						});
					}
				}
				
			})
		);
	}

})(jQuery)	