// JavaScript Document
Galleria.loadTheme('http://www.alaskaglazinginc.com/js/galleria.classic.js');
$(document).ready(function() {
	
	var whichOne;
	var bCoor;
	$('#h-nav li').mousedown(function() {
								  
		whichOne = $(this).index();
		switch(whichOne)
		{
			case 0: bCoor = '-276px 0px'
			break;
			case 1: bCoor = '-292px -50px'
			break;
			case 2: bCoor = '-202px -100px'
			break;
			case 3: bCoor = '-336px -150px'
		}
		$(this).find('a').css({backgroundPosition: ''+bCoor+''});
		return false;
									  
	}).mouseup(function(){

		switch(whichOne)
		{
			case 0: bCoor = '0px 0px'
			break;
			case 1:  bCoor = '0px -50px'
			break;
			case 2: bCoor = '0px -100px'
			break;
			case 3: bCoor = '0px -150px'
		}
		$(this).find('a').css({backgroundPosition: ''+bCoor+''});
		return false;
		
	});
	
	$('#pp-button').mousedown(function() {						  
		$(this).css({backgroundPosition: '-498px 0px'});							  
	}).mouseup(function(){
		$(this).css({backgroundPosition: '-498px 0px'});
	}).hover(function() { 
		$(this).css({backgroundPosition: '-249px 0px'});
	},function() { 
		$(this).css({backgroundPosition: '0px 0px'});
	});
	
	$('#feat-load').ajaxStart(function() {
		$(this).show();
	}).ajaxStop(function() {
		$(this).hide();	
	});
	
	var mapIn = 'false';
	$('#f-button').toggle(function() {				   
		$('#projects-list').fadeIn('slow');
		if (mapIn == 'false') {	
		$('#Feature').append('<div id="map-holder"></div>');
		$('#map-holder').load('http://www.alaskaglazinginc.com/Inc/map.inc.php');
		mapIn = 'true';
		}
		$('#map-holder').fadeIn('slow');
		return false;
	
	},function() {
		
		$('#projects-list').fadeOut('slow');
		$('#map-holder').fadeOut('slow');
		return false;
		
	});
	
	$('.index-con').append('<img id="layout-i" src="http://www.alaskaglazinginc.com/images/index-con-bg-bot.jpg">');
	$('.sub-con').append('<img id="layout-i" src="http://www.alaskaglazinginc.com/images/sub-con-bg-bot.jpg">');
	
	 if(!$.browser.msie6){
     $('.images-index').galleria({ height:392 });
  	 } else {
	 $('.images-index').galleria({ height:350 });	 
	 }
	
	
	
	$('.image-blog').galleria({ height:500 });
	
	
	
	$('ul#projects-list li a').click(function() { 
					
	var a = $(this).parent().index();
	myclick(a);
	return false;

	});


});

// clears and replaces text in form input fields and textareas
// -----------------------------------------------------------------
function clearText(thefield) {
  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
} 
function replaceText(thefield) {
  if (thefield.value=="") { thefield.value = thefield.defaultValue }
}


