// AJAX preloading image
var VCX = {
		
	//Display Loading Image
	displayLoading:	function(){
						var domId = '#loading'; 
						jQuery(domId).html('<img src="/img/big.loader.gif" />').show();
					//	$.facebox.loading();
					},
	//Hide Loading Image
	hideLoading:	function(){
						var domId = '#loading'; 
						jQuery(domId).hide();
					//	jQuery(document).trigger('close.facebox')
					},
	// in facebox, embeded html for loading 				
	snapLoadingHtml : '<div id="snapLoading"><img src="/img/big.loader.gif"  /></div>',				
	
	flashMessageBehavour: function(){
//							$('#flashMessage').animate({"opacity": 0}, 5000,  function(){$(this).slideUp(300, function(){$(this).remove(); });});
//							setTimeout("$('#flashMessage').slideUp(function(){$(this).remove(); })", 5000);
						var outMsg = $('#flashMessage').html();
						if(outMsg) {
							jQuery('#flashMessage').remove();
							jQuery.facebox('<div id="flashMessage">' + outMsg + '</div>');
							setTimeout("jQuery(document).trigger('close.facebox')", 3000);
						}
					},
	// quickly wrap the ajax element with loading image.
	quickOverlay : function(obj) {
		    var w = obj.outerWidth();
		    var h = obj.outerHeight();
		    var o = obj.offset();
		    jQuery('<div />')
		      .appendTo('body')
		      .addClass('quickEditOverlay')
		      .css({
		        top: o.top,
		        left: o.left,
		        width: w,
		        height: h,
		        lineHeight: h + 'px',
		        opacity: 0.8
		      })
		      .ajaxComplete(function () {
		    	  jQuery(this).remove(); 
		    	});
	}		

};

//pop-up window
function openWindow(pageToLoad, winName, width, height, align, toolbar) {
	
	xposition=0; yposition=0;
	if ((parseInt(navigator.appVersion) >= 4 ) && (align)){
		
		xposition = (screen.width - width) / align;
		yposition = (screen.height - height) / (align/2);
	}
	args = "width=" + width + ","
	+ "height=" + height + ","
	+ "resizable=1," 
	+ "scrollbars=1,"
	+ "status=1,"
	+ "titlebar=1,"
	+ "location=0," 
	+ "menubar=0,"
	+ "status=1," 
	+ "toolbar=" + toolbar + ","
	+ "hotkeys=0,"
	+ "screeny=" + yposition + ","  //NN Only
	+ "screenx=" + xposition + ","  //NN Only
	+ "left=" + xposition + ","     //IE Only
	+ "top=" + yposition;           //IE Only
	window.open( pageToLoad,winName,args );
}


if(window.jQuery)(function($){
		$(document).ready(function($) { 
			$("a[rel*=facebox]").facebox(); 
		
		});
		$('img[src$=.png]').ifixpng();
		
		
})(jQuery);

