//<![CDATA[
/*
*** Common scripts
*** Coded by Ricardas Sinkevicius, Mano Svetaine LTD
*** Creation: 2010 12 14
*/

if(typeof(jQuery) !== 'undefined'){
	
	$j(document).ready(function(){
		
		/*if (jQuery.browser.safari && $j('.scroll-pane img').size > 0){
			//For safari browser, first wait for images to fully load, because webkit browsers have bug so that they fire READY event to early
			var scrollImageLoaded = 0;
			$j('.scroll-pane img').load(function(){
				scrollImageLoaded = scrollImageLoaded + 1;
				//Initiate JScroll after all images loaded
				if(scrollImageLoaded == $j('.scroll-pane img').size()) $j('.scroll-pane').jScrollPane({showArrows: true});
			});
		} else {
			//Initiate JScroll
			$j('.scroll-pane').jScrollPane({showArrows: true});
		}*/
		
		//Wrap text inputs for styling
		$j('input[type="text"]').each(function(){
			/*$j(this).wrap('<span class="input-wrap"></span>');
			$j(this).addClass('input-wrapped');*/
		});
		
		//Wrap buttons for styling
		$j('button, .button, input[type="submit"]').each(function(){
			$j(this).wrap('<span class="button-wrap"></span>');
			$j(this).addClass('button-wrapped');
		});
		
		//Wrap styled links
		$j('a.link-styled').each(function(){
			$j(this).wrap('<span class="link-wrap"></span>');
			$j(this).addClass('link-wrapped');
		});
		
		//Show select tags
		$j('select').each(function(){
			$j(this).css('display', 'inline');
		});
		
		//Print button
		$j('#print-preview-print a:first').click(function(){
			window.print();
			//Hide print preview
			window.location = $j(this).attr('href');
			return false;
		});
		
		//script to look for slimboxed images
		$j('img.caption').each(function(){
			$j(this).wrap('<a href="'+this.src+'" rel="lightbox-imgs"></a>');
		});
			
	});

}
//]]>
