$(document).ready(function () { 
	
	$.preloadCssImages();
	$('div, span, img, a').pngFix();
	$("a[rel^='prettyPhoto']").prettyPhoto();
	
	var contactWidth = "";
	if (($.browser.name == 'msie') && ($.os.name == 'win') && ($.browser.versionNumber >= 7)){
		contactWidth = "505px";
	}
	else {
		contactWidth = "490px";
	}


/*
	$( "#mainNavMenu" ).mousemove(function(e){
		var x = (e.pageX - 1253); //1501.5    847.5
		$("#mainNavOnion").css({'background-position': x+'px bottom'});
		$("#mainNavSpotlight").css({'background-position': x+'px top'});
		
		$('h3').text(x);


	});
*/




	$('#header span#links a').click(function(){
	
		var id = this.rel;
		
		if (id) {
			$('html,body').animate({scrollTop: ($("#"+id).offset().top - 126)},'slow');

			return false;
		}
	});

	$(".galleryThumb").mouseover(function(){
		var image = this.rel;
		image = image.split("designs/")[1].split(".jpg")[0] + "_large.jpg";
		//$(this).parents(".text.article").find(".largeImage").css({"background-image":"url(../lib/core/js/prettyPhoto/images/prettyPhoto/facebook/loader.gif)"});
		$(this).parents(".text.article").find(".largeImage").css({"background-image":"url(../images/designs/"+image+")"});
		$(this).parents(".text.article").find(".galleryThumb").removeClass("selected");
		$(this).addClass("selected");
	});
	
	$(".galleryThumb").click(function(){ return false; });

		function contactOpen(){
			$(this).parent(".contactButtonWrapper").animate({
				width: contactWidth
			}, {
				duration: 300, 
				specialEasing: {
				width: 'linear'
			}, 
				complete: function() {
			}
		});
		
		$(this).parent(".contactButtonWrapper").children(".contactSlider").animate({
				width: contactWidth
			}, {
				duration: 300, 
				specialEasing: {
				width: 'linear'
			}, 
				complete: function() {
			}
		});
		
		$(this).parent(".contactButtonWrapper").children(".contactSlider .contactSliderEnd").animate({
				width: contactWidth
			}, {
				duration: 300, 
				specialEasing: {
				width: 'linear'
			}, 
				complete: function() {
			}
		});
	
		$(this).unbind();
		$(this).bind('click', contactClose);
	
		return false;
	
	};
	
	function contactClose(){
		
		$(this).parent(".contactButtonWrapper").animate({
				width: "149px"
			}, {
				duration: 570, 
				specialEasing: {
				width: 'linear'
			}, 
				complete: function() {
			}
		});
		
		$(this).parent(".contactButtonWrapper").children(".contactSlider").animate({
				width: "100px"
			}, {
				duration: 570, 
				specialEasing: {
				width: 'linear'
			}, 
				complete: function() {
			}
		});
		
		$(this).parent(".contactButtonWrapper").children(".contactSlider .contactSliderEnd").animate({
				width: "100px"
			}, {
				duration: 570, 
				specialEasing: {
				width: 'linear'
			}, 
				complete: function() {
			}
		});
	
		$(this).unbind();
		$(this).bind('click', contactOpen);
	
		return false;
		
	};
	
	
	$(".contactbutton").bind('click', contactOpen);
	
	
		var conEmail = "";
		conEmail = "sales";
		conEmail += "@sollar";
		conEmail += "syst";
		conEmail += "ems.c";
		conEmail += "o";
		conEmail += "m";
	
	$(".contactEmail").html(conEmail);
	$(".contactEmail").attr("href","mailto:"+conEmail);
	
	$(".contactbutton").attr("href","mailto:"+conEmail);
	

  
});
