ddsmoothmenu.init({
 mainmenuid: "smoothmenu1", //menu DIV id
 orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
 classname: 'ddsmoothmenu', //class added to menu's outer DIV
 //customtheme: ["#1c5a80", "#18374a"],
 contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

function prettyphoto(){
    $("a[rel^='prettyPhoto']").prettyPhoto({
			animation_speed: 'fast', /* fast/slow/normal */
			slideshow: 5000, /* false OR interval time in ms */
			autoplay_slideshow: false, /* true/false */
			opacity: 0.80, /* Value between 0 and 1 */
			show_title: true, /* true/false */
			allow_resize: true, /* Resize the photos bigger than viewport. true/false */
			default_width: 500,
			default_height: 344,
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'dark_rounded', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
			horizontal_padding: 20, /* The padding on each side of the picture */
			hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
			wmode: 'opaque', /* Set the flash wmode attribute */
			autoplay: true, /* Automatically start videos: True/False */
			modal: false, /* If set to true, only the close button will close the window */
			deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
			overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
			keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
			changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
			callback: function(){}, /* Called when prettyPhoto is closed */
			ie6_fallback: true,
			markup: '<div class="pp_pic_holder"> \
						<div class="ppt">&nbsp;</div> \
						<div class="pp_top"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
						<div class="pp_content_container"> \
							<div class="pp_left"> \
							<div class="pp_right"> \
								<div class="pp_content"> \
									<div class="pp_loaderIcon"></div> \
									<div class="pp_fade"> \
										<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
										<div class="pp_hoverContainer"> \
											<a class="pp_next" href="#">next</a> \
											<a class="pp_previous" href="#">previous</a> \
										</div> \
										<div id="pp_full_res"></div> \
										<div class="pp_details"> \
											<div class="pp_nav"> \
												<a href="#" class="pp_arrow_previous">Previous</a> \
												<p class="currentTextHolder">0/0</p> \
												<a href="#" class="pp_arrow_next">Next</a> \
											</div> \
											<p class="pp_description"></p> \
											{pp_social} \
											<a class="pp_close" href="#">Close</a> \
										</div> \
									</div> \
								</div> \
							</div> \
							</div> \
						</div> \
						<div class="pp_bottom"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
					</div> \
					<div class="pp_overlay"></div>',
			gallery_markup: '<div class="pp_gallery"> \
								<a href="#" class="pp_arrow_previous">Previous</a> \
								<div> \
									<ul> \
										{gallery} \
									</ul> \
								</div> \
								<a href="#" class="pp_arrow_next">Next</a> \
							</div>',
			image_markup: '<img id="fullResImage" src="{path}" />',
			flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
			quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
			iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
			inline_markup: '<div class="pp_inline">{content}</div>',
			custom_markup: '',
			social_tools: false /* html or false to disable */
		});
}

$(document).ready(function(){
    $("a[rel^='prettyPhoto']").prettyPhoto();
});

function show_site(num){
    $.ajax({
        url: 'update.php',
        data: 'site='+num,
        type: 'GET',
        cache: false,
        success: function(data) {
            var req = data.split("+:+");
            $('#Content').html(req[0]);
            if(req[1] >= 1){carousel();}
            prettyphoto();
        }
    });
}

function show_pics(num){
    $.ajax({
        url: 'update.php',
        data: 'pics='+num,
        type: 'GET',
        cache: false,
        success: function(data) {
            var req = data.split("+:+");
            $('#Content').html(req[0]);
            if(req[1] >= 1){carousel();}
            prettyphoto();
        }
    });
}

function show_news(num){
    $.ajax({
        url: 'update.php',
        data: 'news='+num,
        type: 'GET',
        cache: false,
        success: function(data) {
            $('#Content').html(data);
        }
    });
}

function carousel(){
        
    //jCarousel Plugin
    $('#carousel').jcarousel({
        vertical: true, //display vertical carousel
        scroll: 1,  //auto scroll
        auto: 2,    //the speed of scrolling
        wrap: 'last',   //go back to top when reach last item
        initCallback: mycarousel_initCallback   //extra called back function

    });
 
    //Front page Carousel - Initial Setup
    //set all the item to full opacity
    //$('div#slideshow-carousel a img').css({'opacity': '0.5'});
     
    //readjust the first item to 50% opacity
    //$('div#slideshow-carousel a img:first').css({'opacity': '1.0'});
     
    //append the arrow to the first item
    $('div#slideshow-carousel li a:first').append('<span class="arrow"></span>')
 
  
    //Add hover and click event to each of the item in the carousel
    $('div#slideshow-carousel li a').hover(
        function () {
             
            //check to make sure the item is not selected
            if (!$(this).has('span').length) {
                //reset all the item's opacity to 50%
                //$('div#slideshow-carousel li a img').stop(true, true).css({'opacity': '0.5'});
                 
                //adust the current selected item to full opacity
                //$(this).stop(true, true).children('img').css({'opacity': '1.0'});
            }      
        },
        function () {
                 
            //on mouse out, reset all the item back to 50% opacity
            //$('div#slideshow-carousel li a img').stop(true, true).css({'opacity': '0.5'});
             
            //reactivate the selected item by loop through them and look for the one
            //that has the span arrow
            $('div#slideshow-carousel li a').each(function () {
                //found the span and reset the opacity back to full opacity
                if ($(this).has('span').length) $(this).children('img').css({'opacity': '1.0'});
 
            });
                 
        }
    ).click(function () {
 
        //remove the span.arrow
        $('span.arrow').remove();
         
        //append it to the current item       
        $(this).append('<span class="arrow"></span>');
         
        //remove the active class from the slideshow main
        $('div#slideshow-main li').removeClass('active');
         
        //display the main image by appending active class to it.       
        $('div#slideshow-main li.' + $(this).attr('rel')).addClass('active');  
             
        return false;
    });
 
 
}
 
 
//Carousel Tweaking
function mycarousel_initCallback(carousel) {
     
    // Pause autoscrolling if the user moves with the cursor over the clip.
    // resume otherwise
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
}
















