// Coleman Stevenson
// jQuery 1.3.2
// Pit Design Group
// Do not use without permission....

 var intval=""
    function start_Int(){
        if(intval==""){
          intval=window.setInterval("slideSwitch()",5000)
      }else{
          stop_Int()
      }
    }

    function stop_Int(){
        if(intval!=""){
          window.clearInterval(intval)
          intval=""
      }
    }
	
	 var intval2=""
    function start_Int2(){
        if(intval2==""){
          intval2=window.setInterval("slider2Switch()",5000)
      }else{
          stop_Int2()
      }
    }

    function stop_Int2(){
        if(intval2!=""){
          window.clearInterval(intval2)
          intval2=""
      }
    }

$(document).ready( function () {
							
				   
							   $("#about").click( function () {
															stop_Int2();
															stop_Int();
													   $('.container,.links').fadeOut('fast')
																	  $('<div id="about-bg"></div>').appendTo('.bg-container');
																	  $('.bg-container').animate({ marginLeft : '-1280px' }, 1000, function () {
																					$('.container').empty()
																					$('.container').load('about.html', function () {
																					$('.container,.links').fadeIn('normal')
																																});
																					$('#index-bg').remove()
																					$('#design-bg').remove()
																					$('#portfolio-bg').remove()
																					$('#control-bg').remove()
																					$('#custom-bg').remove()
																					$('#contact-bg').remove()
																					$('.bg-container').css("margin-left","0px");
																					$(".hover").animate({ marginLeft : '99px' , width : '44px' }, 'fast')
																					origin = '99px'
																					begwidth = '44px'
																			
																					
																																		 });
							   });
							   $("#home").click( function () {
													  $('.container,.links').fadeOut('fast');
																	  $('<div id="index-bg"></div>').appendTo('.bg-container');
																	  $('.bg-container').animate({ marginLeft : '-1280px' }, 1000, function () {
																					$('.container').empty()
																					$('.container').load('index2.html', function () {
																					$('.container,.links').fadeIn('normal')
																																});
																					$('#about-bg').remove()
																					$('#design-bg').remove()
																					$('#portfolio-bg').remove()
																					$('#control-bg').remove()
																					$('#custom-bg').remove()
																					$('#contact-bg').remove()
																					$('.bg-container').css("margin-left","0px");
																					$(".hover").animate({ marginLeft : '5px' , width : '42px' }, 'fast')
																					origin = '5px'
																					begwidth = '42px'
																																		 });
							   });
							   	   $("#services").click( function () {
													   $('.container,.links').fadeOut('fast')
																	  $('<div id="design-bg"></div>').appendTo('.bg-container');
																	  $('.bg-container').animate({ marginLeft : '-1280px' }, 1000, function () {
																					$('.container').empty()
																					$('.container').load('design.html', function () {
																					$('.container,.links').fadeIn('normal')
																																});
																					$('#index-bg').remove()
																					$('#about-bg').remove()
																					$('#portfolio-bg').remove()
																					$('#control-bg').remove()
																					$('#custom-bg').remove()
																					$('#contact-bg').remove()
																					$(".hover").css({ marginLeft : '197px' , width : '63px'  })
																					$('.bg-container').css("margin-left","0px");
																					origin = '192px'
																					begwidth = '63px'
																																		 });
							   });
								   $("#design").click( function () {
													   $('.container,.links').fadeOut('fast')
																	  $('<div id="design-bg"></div>').appendTo('.bg-container');
																	  $('.bg-container').animate({ marginLeft : '-1280px' }, 1000, function () {
																					$('.container').empty()
																					$('.container').load('design.html', function () {
																					$('.container,.links').fadeIn('normal')
																																});
																					$('#index-bg').remove()
																					$('#about-bg').remove()
																					$('#portfolio-bg').remove()
																					$('#control-bg').remove()
																					$('#custom-bg').remove()
																					$('#contact-bg').remove()
																					$(".hover").css({ marginLeft : '197px' , width : '63px'  })
																					$('.bg-container').css("margin-left","0px");
																					origin = '192px'
																					begwidth = '63px'
																																		 });
							   });
								   	   	   $("#portfolio").click( function () {
																		stop_Int2();
															stop_Int();
													   $('.container,.links').fadeOut('fast')
																	  $('<div id="portfolio-bg"></div>').appendTo('.bg-container');
																	  $('.bg-container').animate({ marginLeft : '-1280px' }, 1000, function () {
																					$('.container').empty()
																					
																					$('.container').load('portfolio.html', function () {
																					$('.container,.links').fadeIn('normal')
																																});
																					$('#index-bg').remove()
																					$('#about-bg').remove()
																					$('#design-bg').remove()
																					$('#control-bg').remove()
																					$('#custom-bg').remove()
																					$('#contact-bg').remove()
																					$('.bg-container').css("margin-left","0px");
																					$(".hover").animate({ marginLeft : '297px' , width : '59px' }, 'fast')
																					origin = '297px'
																					begwidth = '59px'
																						
																																		 });
							   });
										    $("#control").click( function () {
													   $('.container,.links').fadeOut('fast')
																	  $('<div id="control-bg"></div>').appendTo('.bg-container');
																	  $('.bg-container').animate({ marginLeft : '-1280px' }, 1000, function () {
																					$('.container').empty()
																					$('.container').load('control.html', function () {
																					$('.container,.links').fadeIn('normal')
																																});
																					$('#index-bg').remove()
																					$('#about-bg').remove()
																					$('#design-bg').remove()
																					$('#portfolio-bg').remove()
																					$('#custom-bg').remove()
																					$('#contact-bg').remove()
																					$('.bg-container').css("margin-left","0px");
																					origin = '192px'
																					begwidth = '63px'
																																		 });
							   });
											 $("#lighting").click( function () {
													   $('.container,.links').fadeOut('fast')
																	  $('<div id="custom-bg"></div>').appendTo('.bg-container');
																	  $('.bg-container').animate({ marginLeft : '-1280px' }, 1000, function () {
																					$('.container').empty()
																					$('.container').load('custom.html', function () {
																					$('.container,.links').fadeIn('normal')
																																});
																					$('#index-bg').remove()
																					$('#about-bg').remove()
																					$('#design-bg').remove()
																					$('#portfolio-bg').remove()
																					$('#control-bg').remove()
																					$('#contact-bg').remove()
																					$('.bg-container').css("margin-left","0px");
																					origin = '192px'
																					begwidth = '63px'
																																		 });
							   });
											 $("#contact").click( function () {
													   $('.container,.links').fadeOut('fast')
																	  $('<div id="contact-bg"></div>').appendTo('.bg-container');
																	  $('.bg-container').animate({ marginLeft : '-1280px' }, 1000, function () {
																					$('.container').empty()
																					$('.container').load('contact.html', function () {
																					$('.container,.links').fadeIn('normal')
																																});
																					$('#index-bg').remove()
																					$('#about-bg').remove()
																					$('#design-bg').remove()
																					$('#portfolio-bg').remove()
																					$('#control-bg').remove()
																					$('#custom-bg').remove()
																					$('.bg-container').css("margin-left","0px");
																					origin = '393px'
																					begwidth = '57px'
																																		 });
							   });
							   origin = $('.hover').css('marginLeft')
							   begwidth = $('.hover').css('width')
							 $("img#home").hover( function () {
														  $(".hover").stop( true );
																  $(".hover").animate({ marginLeft : '5px' , width : '42px' }, 'fast')
																  },  function () {
																  $(".hover").animate({ marginLeft : origin , width : begwidth }, 1000)
																
							 });
							 
							  $("img#about").hover( function () {
														     $(".hover").stop( true );
																  $(".hover").animate({ marginLeft : '99px' , width : '44px' }, 'fast')
																  },  function () {
																  $(".hover").animate({ marginLeft : origin , width : begwidth }, 1000)
							 });
							    $("img#services").hover( function () {
														     $(".hover").stop( true );
																  $(".hover").animate({ marginLeft : '192px' , width : '63px' }, 'fast')
																  },  function () {
																  $(".hover").animate({ marginLeft : origin , width : begwidth }, 1000)
							 });
								  $("img#portfolio").hover( function () {
														     $(".hover").stop( true );
																  $(".hover").animate({ marginLeft : '297px' , width : '59px' }, 'fast')
																  },  function () {
																  $(".hover").animate({ marginLeft : origin , width : begwidth }, 1000)
							 });
								    $("img#contact").hover( function () {
														     $(".hover").stop( true );
																  $(".hover").animate({ marginLeft : '393px' , width : '57px' }, 'fast')
																  },  function () {
																  $(".hover").animate({ marginLeft : origin , width : begwidth }, 1000)
							 });
									
							   
							   
								 });			

//About Slideshow
/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}



//function ppcontrol() { 
//
	//	   var $playpause = $("#playpause").hasClass('pause')
		//	if   ( $playpause = true ) clearInterval( "slideSwitch()" );
  			//else  setInterval( "slideSwitch()", 2000);
		
//}

function slider2Switch() {
    var $active = $("#slideshow2 IMG.active2");

    if ( $active.length == 0 ) $active = $("#slideshow2 IMG:last");

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $("#slideshow2 IMG:first");

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active2');

    $next.css({opacity: 0.0})
        .addClass('active2')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active2 last-active2');
        });
}



//function ppcontrol() { 
//
	//	   var $playpause = $("#playpause").hasClass('pause')
		//	if   ( $playpause = true ) clearInterval( "slideSwitch()" );
  			//else  setInterval( "slideSwitch()", 2000);
		
//}
$(document).ready(function () {
	var mediainterval = ""
	var popinterval = ""
		awardGlow();
  popinterval = window.setInterval("awardGlow()",3600)
	$('.arts-award').live('click', function () {	  
	 window.clearInterval(popinterval)
	showPopup();
	});
	$('.container').live('mouseenter', function () {
		window.clearInterval(popinterval)
		$(".arts-award").clearQueue();
		$(".arts-award").stop();
	if ($("#popup").hasClass("seen")) {}
	else if ($("#popup").hasClass("loaded")) {	  
	$("#popup").show(100, function () {
		  $("#popup").addClass('seen');	
	  });}
	  else {
	  }
	  });
	  });
	  
$(document).ready(function() {
	  $("#popup_close").live('click', function () {
		  $("#popup").hide()
		 popinterval = window.setInterval("awardGlow()",3600)
		  });
});
	  

function showPopup() {
		$("#popup").show()
}

function awardGlow() {
	$(".arts-award").fadeTo(1800,0.2);
	$(".arts-award").fadeTo(1800,1.0);
}

