jQuery.extend({
    //dims the screen
    dimScreen: function(speed, opacity, callback) {
        if(jQuery('#__dimScreen').size() > 0) return;
        
        if(typeof speed == 'function') {
            callback = speed;
            speed = null;
        }

        if(typeof opacity == 'function') {
            callback = opacity;
            opacity = null;
        }

        if(speed < 1) {
            var placeholder = opacity;
            opacity = speed;
            speed = placeholder;
        }
        
        if(opacity >= 1) {
            var placeholder = speed;
            speed = opacity;
            opacity = placeholder;
        }

        speed = (speed > 0) ? speed : 500;
        opacity = (opacity > 0) ? opacity : 0.5;
		
		return jQuery('<div>').attr({
                'id': '__dimScreen'
                ,'fade_opacity': opacity
                ,'speed': speed
            }).css({
				background: '#000'
				,height: jQuery(document).height() + 'px'
				,left: '0px'
				,opacity: 0
				,position: 'absolute'
				,top: '0px'
				,width: jQuery(document).width() + 'px'
				,zIndex: 999
			}).appendTo('body').fadeTo(speed, opacity, callback);
    },
    
    //stops current dimming of the screen
    dimScreenStop: function(callback) {
        var x = jQuery('#__dimScreen');
        var opacity = x.attr('fade_opacity');
        var speed = x.attr('speed');
        x.fadeOut(speed, function() {
            x.remove();
            if(typeof callback == 'function') callback();
        });
    }
});


jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

var themeimg = 'themes/pneb/images/';

jQuery(document).ready(function(){
	jQuery('#parent-link-'+parentid).addClass('current');
	jQuery('blockquote').each(function(){
		jQuery(this).prepend('<div class="top"></div>');
		jQuery(this).append('<div class="bottom"></div>');
		jQuery(this).append('<div class="arrow"></div>');
	});
	jQuery('.page-photo').each(function(i){
		jQuery(this).after('<div class="pave-photo-div" id="page-photo-'+i+'"></div>');
		jQuery(this).removeClass('page-photo').appendTo('#page-photo-'+i)
		jQuery('<div>').addClass('page-photo-text').html(jQuery(this).attr('alt')).appendTo('#page-photo-'+i);
	});
	jQuery('.page-list-photo').each(function(i){
		jQuery(this).after('<div class="pave-lphoto-div" id="page-lphoto-'+i+'"></div>');
		jQuery(this).removeClass('page-list-photo').appendTo('#page-lphoto-'+i)
		jQuery('<div>').addClass('page-photo-text').html(jQuery(this).attr('alt')).appendTo('#page-lphoto-'+i);
	});
	jQuery.preloadImages(themeimg + "btn-login-f2.gif", themeimg + "btn-submit-f2.gif");
	jQuery('#SearchForm_SearchForm').attr('action','search-result/SearchForm');
	jQuery('#SearchForm_SearchForm_Search').attr('value','');
	jQuery('#SearchForm_SearchForm_Search').bind('focus',function(){
		jQuery(this).select();
	});
	jQuery('#SearchForm_SearchForm_Search').bind('keydown',function(e){
		if (e.keyCode==13){
			jQuery('#SearchForm_SearchForm').submit();
		}
	});
	jQuery(document).pngFix(); 
});

function getItemID(item,txt){
	return item.substr(txt.length,item.length - txt.length);
}

