$(document).ready(function() {
   resized = false;
   layoutFix();   

});

$(window).resize(function(){
	layoutFix();
});

$(document).ready(function(){
	if(document.getElementById('form_name')){
		var orig = document.getElementById('form_name').value;
		document.getElementById('form_name').value = document.getElementById('form_results_id').value;
		document.getElementById('form_results_id').value = orig;
	}
});


function layoutFix(){
	
	var width = $(window).width();
	if(width<1024){
	
		// resize main layout elements
		
		$('.holder').css('background','url(/images/body-bg-sm.gif) repeat-y center top');
		$('.holder-btm').css('background','url(/images/main-bg-sm.gif) repeat-y center top');
		
		$('.main').css('width','900px');
		$('.content').css('width','900px');
		$('.content').css('height','365px');

		$('.content-int').css('height','356px');

		$('.content-internal').css('margin-left','40px');
		$('.content-internal').css('width','460px');

		$('.top').css('width','900px');
		$('.top-curve').css('width','900px');
		
		$('.menu').css('width','900px');
		$('#nav').css('margin-left','22px');
		$('#nav a').css('padding-right','7px');

		$('#emergency-msg').css('width','730px');
		$('#emergency-msg').css('height','220px');
		
		
		$('#text-size').css('left','768px');
		$('.content-bottom').css('padding','0 30px 30px');
		$('.content-bottom').css('width','840');
		$('.left').css('width','360');
		
		if(flippingBook){

						flippingBook.pages = [
			"pages-sm/page-001.jpg",
			"pages-sm/page-002.jpg",
			"pages-sm/page-003.jpg",
			"pages-sm/page-004.jpg",
			"pages-sm/page-005.jpg",
			"pages-sm/page-006.jpg",
			"pages-sm/page-007.jpg",
			"pages-sm/page-008.jpg",
			"pages-sm/page-009.jpg",
			"pages-sm/page-010.jpg",
			"pages-sm/page-011.jpg",
			"pages-sm/page-012.jpg",
			"pages-sm/page-013.jpg",
			"pages-sm/page-014.jpg",
			"pages-sm/page-015.jpg",
			"pages-sm/page-016.jpg",
			"pages-sm/page-017.jpg",
			"pages-sm/page-018.jpg",
			"pages-sm/page-019.jpg",
			"pages-sm/page-020.jpg",
			"pages-sm/page-021.jpg",
			"pages-sm/page-022.jpg"
			];

		// define custom book settings here
		flippingBook.settings.bookWidth = 900;
		flippingBook.settings.bookHeight = 365;
		flippingBook.settings.pageBackgroundColor = 0x22408f;
		flippingBook.settings.backgroundColor = 0x22408f;
		flippingBook.settings.zoomUIColor = 0x22408f;
		flippingBook.settings.useCustomCursors = false;
		flippingBook.settings.dropShadowEnabled = false;
		flippingBook.settings.zoomImageWidth = 992;
		flippingBook.settings.zoomImageHeight = 1403;
		flippingBook.settings.downloadURL = "";
		//flippingBook.settings.flipSound = "sounds/02.mp3";
		flippingBook.settings.flipCornerStyle = "false";
		flippingBook.settings.zoomHintEnabled = true;

		// default settings can be found in the flippingbook.js file
		flippingBook.create();

		}




		resized = true;
	}
	else if(resized){

		$('.holder').css('background','url(/images/body-bg.gif) repeat-y center top');
		$('.holder-btm').css('background','url(/images/main-bg.gif) no-repeat center top');
		
		$('.main').css('width','1000px');
		$('.content').css('width','1000px');
		$('.content').css('height','481px');

		$('.content-int').css('height','356px');

		$('.content-internal').css('margin-left','40px');
		$('.content-internal').css('width','430px');

		

		
		$('.top').css('width','1000px');
		$('.top-curve').css('width','1000px');
		
		$('.menu').css('width','1000px');
		$('#nav').css('margin-left','55px');
		$('#nav a').css('padding-right','13px');

		$('#emergency-msg').css('width','840px');
		$('#emergency-msg').css('height','321px');
		
		
		$('#text-size').css('left','836px');
		$('.content-bottom').css('padding','0 50px 30px');

		$('.content-bottom').css('width','900');
		$('.left').css('width','410');

		if(flippingBook){

		flippingBook.pages = [
			"pages/page-001.jpg",
			"pages/page-002.jpg",
			"pages/page-003.jpg",
			"pages/page-004.jpg",
			"pages/page-005.jpg",
			"pages/page-006.jpg",
			"pages/page-007.jpg",
			"pages/page-008.jpg",
			"pages/page-009.jpg",
			"pages/page-010.jpg",
			"pages/page-011.jpg",
			"pages/page-012.jpg",
			"pages/page-013.jpg",
			"pages/page-014.jpg",
			"pages/page-015.jpg",
			"pages/page-016.jpg",
			"pages/page-017.jpg",
			"pages/page-018.jpg",
			"pages/page-019.jpg",
			"pages/page-020.jpg",
			"pages/page-021.jpg",
			"pages/page-022.jpg"
		];

		// define custom book settings here
		flippingBook.settings.bookWidth = 1000;
		flippingBook.settings.bookHeight = 481;
		flippingBook.settings.pageBackgroundColor = 0x22408f;
		flippingBook.settings.backgroundColor = 0x22408f;
		flippingBook.settings.zoomUIColor = 0x22408f;
		flippingBook.settings.useCustomCursors = false;
		flippingBook.settings.dropShadowEnabled = false;
		flippingBook.settings.zoomImageWidth = 992;
		flippingBook.settings.zoomImageHeight = 1403;
		flippingBook.settings.downloadURL = "";
		//flippingBook.settings.flipSound = "sounds/02.mp3";
		flippingBook.settings.flipCornerStyle = "false";
		flippingBook.settings.zoomHintEnabled = true;

		// default settings can be found in the flippingbook.js file
		flippingBook.create();

		}

		
		
	}
}


