jQuery(window).resize(function() {

document.location = document.location

});

var thePage = "home";

var finished = true;

var cl = false;

var clicked = false;

var nclicked = false;

var thCount = 1;

var videoOpen = false;

var theNav = "closed";

function panImages(){
	
}

function loadPage(bwidth,bheight,pagename){
	
	
	if(bheight > bwidth){
		if(bheight > 1440){
		imgDir = "xxlarge";	
		}else{
			if(bheight > 1200){
			imgDir = "xlarge";	
			}else{		
				if(bheight > 1024){
				imgDir = "large";	
				}else{

				    imgDir = "large";
					
				}
			}
		}
		
					
			
	}else{
		
		var ratio = (bwidth/bheight);
		if(ratio >= 1.7){
			
			if(bwidth > 1921){
				imgDir = "ws-xxlarge";
			}else{
				if(bwidth > 1601){
					imgDir = "ws-xlarge";
				}else{
					if(bwidth > 1281){
						imgDir = "ws-large";
					}else{
						if(bwidth > 1025){
							imgDir = "ws-medium";
						}else{
							if(bwidth >641){
								imgDir = "ws-small";
							}else{
								imgDir = "ws-xsmall";
							}
						}
					}
				}
			}
			
		}else{
			if(bwidth > 1921){
				imgDir = "xxlarge";
			}else{
				if(bwidth > 1601){
					imgDir = "xlarge";
				}else{
					if(bwidth > 1281){
						imgDir = "large";
					}else{
						if(bwidth > 1025){
							
							imgDir = "medium";
						}else{
							if(bwidth >641){
								imgDir = "small";
							}else{
								imgDir = "xsmall";
							}
						}
					}
				}
			}
		}
	}

	
thePage = pagename;		
var imgsrc = "images/"+pagename+"/"+imgDir+"/";
var obj = { one:1, two:2, three:3, four:4, five:5, six:6, seven:7, eight:8 };

jQuery.each(obj, function(i, val) {
      $("#" + i).attr("src", imgsrc + val +".jpg");
    })

}


function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function PlayFlashMovie()
{
	var flashMovie=getFlashMovieObject("simplemovie");
	flashMovie.GotoFrame(2);
}

function StopFlashMovie()
{
	var flashMovie=getFlashMovieObject("simplemovie");
	flashMovie.GotoFrame(3);
}


function onBefore(){
	finished = false;
	clicked = false;
	nclicked = false;
	if(videoOpen){
	pauseVideo();
	}
}

function removeDiv(){
	$('#video').empty();
}

function addDiv(){
	$('#video').html("<OBJECT WIDTH='698' HEIGHT='367' ID='simplemovie'CODEBASE='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab'><PARAM NAME='MOVIE' VALUE='flash/video.swf' ><PARAM NAME='PLAY' VALUE='false'><PARAM NAME='LOOP' VALUE='false'><PARAM NAME='QUALITY' VALUE='high'><PARAM NAME='SCALE' VALUE='SHOWALL'><EMBED SRC='flash/video.swf' WIDTH='698' HEIGHT='367' wmode='transparent' swLiveConnect='true' NAME='simplemovie'></EMBED></OBJECT>");
}

function showVideo(){
 videoOpen = true;
 addDiv();
 $("#map-overlay").fadeIn(300);
 $("#video-wrap").show();
 $("#logo").hide();
 $("#wrap").hide();
 $("#nav").hide();
 
}

function pauseVideo(){
	 $("#images").delay(900).cycle('pause');
}

function hideVideo(){
 removeDiv();
 $("#map-overlay").fadeOut(800);
 $("#images").cycle('resume');
 $("#video-wrap").hide();
 $("#logo").show();
 $("#wrap").show();
 $("#nav").show();
 videoOpen = false;
}

function onAfter(){
finished = true;
ns = $('#nav-images a:nth-child(3)').hasClass("activeSlide");
ps = $('#nav-images a:nth-child(1)').hasClass("activeSlide");

if(ns){
	$("#nav-image-wrap").scrollTo('#th3', 800, "easeOutQuint");
	$("#next-btn").fadeOut(800, function(){
					$("#prev-btn").fadeIn(800);				 
										 });
}
if(ps){
	$("#nav-image-wrap").scrollTo('#th1', 800, "easeOutQuint");
	$("#prev-btn").fadeOut(800, function(){
					$("#next-btn").fadeIn(800);				 
										 });
}
}


function closeNav(ele){
  $("#nav").animate({"bottom": "-=145px"},  800, "easeOutQuint");
  $(ele).removeClass("nav-open");
  theNav = "closed";
  
}

function openNav(ele){
  $("#nav").animate({"bottom": "+=145px"}, 800, "easeOutQuint");
  $(ele).addClass("nav-open");
  theNav = "open";
 
}

function openPanel(ele){
  $(ele).parent().animate({"right": "+=430px"}, 800, "easeOutQuint");
  $(ele).parent().parent().siblings(".content-title").fadeOut(200);
  $(ele).addClass("open");
}

function closePanel(ele){
   $(ele).parent().animate({"right": "-=430px"},  800, "easeOutQuint");
   $(ele).parent().parent().siblings(".content-title").delay(300).fadeIn(400);
   $(ele).removeClass("open");
}

$(document).ready(function () {
	

	
$("#slide-controls").toggle(function() {
	$("#images").cycle('pause');
	$("#control").removeClass('resumed');
	$("#control").addClass('paused');
	$("#slide-controls").attr("title","Resume slidehow");
}, function(){
	$("#images").cycle('resume');
	$("#control").removeClass('paused');
	$("#control").addClass('resumed');
	$("#slide-controls").attr("title","Pause slidehow"); 
});

$("#resume-btn").click(function(){
	$("#images").cycle('resume'); 
});

$("#w-video").click(function(){
	showVideo();
});
							
$("#wrap div:nth-child(1)").find(".content-wrap").delay(700).animate({"right": "+=430px"}, 800, "easeOutQuint");
$("#wrap div:nth-child(1)").find("#conta-wrap").delay(700).animate({"right": "+=430px"}, 800, "easeOutQuint");
$("#wrap div:nth-child(1)").find(".content-title").fadeOut(500);
$('.firsty').addClass("open");
							
$('.close-btn').click( function(){
	$("#map-overlay").fadeOut(800);
	$("#map, #privacy-wrap").fadeOut(800);
	if(videoOpen){
		hideVideo();
	}
});

$('#map-thumb').click( function(){
	$("#map-overlay").fadeIn(800);
	$("#map").fadeIn(800);
});

$('#privacy-link').click( function(){
	$("#map-overlay").fadeIn(800);
	$("#privacy-wrap").fadeIn(800);
});

							
$("#next-btn").click( function(){
	
	if(finished){
    nclicked = true;
	$("#nav-image-wrap").scrollTo('#th3', 800, "easeOutQuint");
	$("#next-btn").fadeOut(800, function(){
				$("#prev-btn").fadeIn(400);			 
										 });
	}
});

$("#prev-btn").click( function(){
	if(finished){
   clicked = true;
	$("#nav-image-wrap").scrollTo('#th1', 800, "easeOutQuint");
	$("#prev-btn").fadeOut(800, function(){
					$("#next-btn").fadeIn(400);				 
										 });
	}
});

$("#a-next-btn").click( function(){
	if(finished){
		thCount = thCount + 2;
	 	if(thCount == 3){
			$("#nav-image-wrap").scrollTo('#th3', 800, "easeOutQuint");
			$("#a-prev-btn").fadeIn(800);				 
		}else{
		 	if(thCount == 5){
			 	$("#nav-image-wrap").scrollTo('#th5', 800, "easeOutQuint");
			}else{
			 	if(thCount == 7){
					$("#nav-image-wrap").scrollTo('#th7', 800, "easeOutQuint"); 
					$("#a-next-btn").fadeOut(800);
			 	}
		 	}
	 	}
	}
});

$("#a-prev-btn").click( function(){
	if(finished){
		thCount = thCount - 2;	
    	if(thCount == 1){
			$("#nav-image-wrap").scrollTo('#th1', 800, "easeOutQuint");
			$("#a-prev-btn").fadeOut(800);
		}else{
			if(thCount == 3){
				$("#nav-image-wrap").scrollTo('#th3', 800, "easeOutQuint");
			}else{
				if(thCount == 5){
					$("#nav-image-wrap").scrollTo('#th5', 800, "easeOutQuint");
					$("#a-next-btn").fadeIn(800);
				}
			}
		}
	}
});



							
<!-- paa tool tip -->
$('#paalink').tipsy({gravity: 's', html: true, opacity: 1 });
$('#slide-controls').tipsy({gravity: 's', html: true, opacity: 1, fade: true });
<!-- end tool tip -->

<!-- nav panel -->
$('.nav-header').toggle(function() {
 nl = $(this).hasClass("up");
 if(nl){
 closeNav(this); 
 }else{
 openNav(this);
 }
}, function() {
nl = $(this).hasClass("up");
if(nl){
 openNav(this);	
}else{
 closeNav(this); 
}
});
<!-- end -->


<!-- content panels -->
$('.content-btn').toggle(function() {
 cl = $(this).hasClass("firsty");
  if(cl){
	 closePanel(this); 
  }else{
  openPanel(this);
  }
}, function() {
cl = $(this).hasClass("firsty");
  if(cl){
  openPanel(this);
  }else{
  closePanel(this);
  }
});
<!-- end -->

<!-- content panels -->
$('#cont-btn').toggle(function() {
   $(this).parent().animate({"right": "-=380px"},  800, "easeOutQuint");
   $(this).parent().parent().siblings(".content-title").delay(300).fadeIn(400);
   $(this).removeClass("open");
}, function() {
  $(this).parent().animate({"right": "+=380px"}, 800, "easeOutQuint");
  $(this).parent().parent().siblings(".content-title").fadeOut(200);
  $(this).addClass("open");
});
<!-- end -->

$("#zoom01").miniZoomPan({
			sW: 419,
			sH: 444,
			lW: 838,
			lH: 888
});

<!-- contact -->

$("#contactform").submit(function(){

var str = $(this).serialize();
   $.ajax({
   type: "POST",
   url: "contactForm.php",
   data: str,
   success: function(amsg){
$("#error").ajaxComplete(function(event, request, settings){
if(amsg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
{
$('#error').hide();
$('#pform').hide();
$('#thanks').show();

 oh = ($('#thanks').height());
 $("#cont-btn").height(oh);

 or = ($('#thanks').height());
 $('.content-wrap').height(or);

}
else
{
$('#error').fadeIn(800);
result = amsg;
$('#cont-btn').delay(1000).each(function(){
 ob = ($(this).parents('#conta-wrap').height())
 $(this).height(ob);
});
}
$(this).html(result);
});
}
});
return false;
});
<!-- end contact -->

$("#reset").click(function(){
 $("#error").fadeOut(800);						   
});


$('.scroll-pane').jScrollPane({scrollbarWidth:20, scrollbarMargin:10});
$('.scroll-pane-arch').jScrollPane({scrollbarWidth:20, scrollbarMargin:10});

$('.content-btn').delay(2000).each(function(){
 oh = ($(this).parents('.content-wrap').height())
 $(this).height(oh);
});


$('#cont-btn').delay(2000).each(function(){
 ol = ($(this).parents('#conta-wrap').height())
 $(this).height((ol)-20);
});


});



