// JavaScript Document
$().ready(function() {
	//layout
	$('#mnav0 > a > div').click(function(){
		$('#mnav0 >a >div.current').removeClass('current');
		$(this).addClass('current');
	});
	
	

	// Remove the coda-slider-no-js class from the body
	$("body").removeClass("coda-slider-no-js");
	// Preloader
	$(".coda-slider").children('.panel').hide().end().prepend('<p class="loading">Loading...<br /><img src="../images/ajax-loader.gif" alt="loading..." /></p>');
		
	$('#panel_wrapper_about').load('iam.html #content');
	$('#panel_wrapper_idraw').load('idraw.html #idraw',function(){
		$('#idraw_pic_home').show();
		$('#idraw .logo').click(function(){
			$('#idraw .idraw_pic_control > li').each(function(){
				$orig_class = $(this).attr(('class')).replace('_selected','');
				$(this).attr('class',$orig_class);
			});
			$('.idraw_pic_container').hide();
			$('#idraw_pic_home').show();
		});
		$('#idraw .idraw_pic_control > li').click(function(){
			var $this_class = $(this).attr('class');
			var $selected = $this_class.search('_selected');
			if ($selected>0)	return false;
			$('#idraw .idraw_pic_control > li').each(function(){
				$orig_class = $(this).attr(('class')).replace('_selected','');
				$(this).attr('class',$orig_class);
			});
			$(this).attr('class',$this_class+'_selected');  
			$('.idraw_pic_container').hide(300);
			var $no = $(this).attr('id').slice(8);
			var $picDiv = '#idraw_pic_' + $no;
			$($picDiv).show(1300);
			
						
		});
	});
	$('#panel_wrapper_icontact').load('icontact.html #content');
	$('#panel_wrapper_imake').load('imake.html #imake');
	$('#panel_wrapper_ishop').load('ishop.html #ishop');
	
	$('#panel_wrapper_home').load('home.html #content',function(){
		$('#slides').slides({
				generatePagination: true,
				play: 5000,
				pause: 2500,
				hoverPause: true,
				// Get the starting slide
				start: 1
		});
	});
	
	$('#coda-slider-1').ajaxStop(function(){
      $(this).children('.panel').show().end().find("p.loading").remove();
	  $(this).removeClass("preload").codaSlider({
	   		autoHeight: true,
			autoHeightEaseDuration: 2000,
			autoHeightEaseFunction: "easeInOutExpo",
			autoSlide: false,
			autoSlideInterval: 7000,
			autoSlideStopWhenClicked: true,
			crossLinking: true,
			dynamicArrows: false,
			dynamicArrowLeftText: "&#171; left",
			dynamicArrowRightText: "right &#187;",
			dynamicTabs: false,
			dynamicTabsAlign: "center",
			dynamicTabsPosition: "top",
			externalTriggerSelector: "a.xtrig",
			firstPanelToLoad: 1,
			panelTitleSelector: "h2.title",
			slideEaseDuration: 1000,
			slideEaseFunction: "easeInOutExpo"
		});	
		$hh= $(this).height();
		console.log("this height is "+$hh);
    });
	
	// Kill the preloader
	

	
	  
	
});

