<!--

	//================================================================================================
	// VARIABLES DECLARATION
	//================================================================================================	
	var galleryShow;
	var galleryPos = 0; //start from 0

		//================================================================================================
	// AJAX FUNCTIONS
	//================================================================================================		
	function sendRegistration(firstname, lastname, contact, email, genre, bestday, besttime, hearfrom, comment)
	{
		var url = "process.php";

		var data = "process=registration";
		data = data + "&firstname=" + firstname;
		data = data + "&lastname=" + lastname;
		data = data + "&contact=" + contact;
		data = data + "&email=" + email;
		data = data + "&genre=" + genre;
		data = data + "&bestday=" + bestday;
		data = data + "&besttime=" + besttime;
		data = data + "&hearfrom=" + hearfrom;
		data = data + "&comment=" + escape(comment);
		data = data + "&sid=" + Math.random();

		var req = new Request( {method: 'get', url: '' + url, 

			onSuccess: function(txt) {
				showMessageBox(txt);
				cleanUpRegistrationForm();
			},

			onFailure: function() {
				showMessageBox("Error connecting to server. Please refresh this page...");
			}

		}).send(data);
	}
	
	//================================================================================================
	// FORM FUNCTIONS
	//================================================================================================
	function getCheckedRadioButton(radioObj)
	{
		var value = "";

		if (!radioObj)
		{
			value = "";
		}

		var radioLength = radioObj.length;

		if (radioLength == undefined)
		{
			if (radioObj.checked)
				value = radioObj.value;
			else
				value = "";
		}

		for (var i=0;i<radioLength;i++)
		{
			if (radioObj[i].checked)
			{
				value = radioObj[i].value;	
			}
		}

		return value;
	}

	function setCheckedRadioButtonByIndex(radioObj, index)
	{
		if (radioObj)
		{
			var radioLength = radioObj.length;

			if (radioLength != undefined)
			{
				for(var i=0;i<radioLength;i++)
				{
					if (i == index)
					{
						radioObj[i].checked = true;	
					}
				}
			}
		}	
	}

	function submitRegistration()
	{
		var message = "";
		var form = document.registrationform;

		var firstname = form.firstname.value.replace("First Name", "");
		var lastname = form.lastname.value.replace("Last Name", "");
		var contact = form.contact.value.replace("Contact Number", "");
		var email = form.email.value.replace("Email Address", "");
		var genre = getCheckedRadioButton(form.genre);
		var bestday = form.bestday.value.replace("What day best suits you?", "");
		var besttime = form.besttime.value.replace("What time is best for you?", "");
		var hearfrom = form.hearfrom.value.replace("How do you hear about us?", "");
		var comment = form.comment.value.replace("Message or Enquiry", "");

		var valid = true;

		if (firstname == "")
		{
			valid = false;
			message = message + "Please make sure you have entered your first name.\n";
		}
		else if (lastname == "")
		{
			valid = false;
			message = message + "Please make sure you have entered your last name.\n";
		}
		else if (contact == "")
		{
			valid = false;
			message = message + "Please make sure you have entered your contact number.\n";
		}
		else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)))
		{
			valid = false;
			message = message + "Please make sure you have entered a valid e-mail address.\n";
		}

		if (valid == true) 
		{
			sendRegistration(firstname, lastname, contact, email, genre, bestday, besttime, hearfrom, comment);
		}
		else
		{
			alert(message);
		}
	}

	function cleanUpRegistrationForm()
	{
		var form = document.registrationform;

		form.firstname.value = "First Name";
		form.lastname.value = "Last Name";
		form.contact.value = "Contact Number";
		form.email.value = "Email Address";
		setCheckedRadioButtonByIndex(form.genre, 0);
		form.bestday.value = "What day best suits you?";
		form.besttime.value = "What time is best for you?";
		form.hearfrom.value = "How do you hear about us?";
		form.comment.value = "Message or Enquiry";
	}

	//================================================================================================
	// LAYOUT FUNCTIONS 
	//================================================================================================			
	function showMessageBox(txt)
	{
		//setup the div
		// var div_wrapper = $('wrapper_message_box');
		// var div_box = $('message_box');
		// var div_text = $('message_text');

		// div_text.set('html', txt);
		// div_wrapper.setStyle('display', 'block');
		// div_box.setStyle('display', 'block');
		alert(txt);
	}

	function initBackgrounds()
	{
		var container = 'background';
		var path = 'images/site/';
		var images;
		
		if ($chk($(container)))
		{
			var bg = $(container).getChildren('div')[0];
			//var bg_id = bg[0].get('id');
			
			/* preloading */  			
			images = [ path + 'bg.jpg' ];
								
			//create the asset.images
			assetBackgrounds = new Asset.images(images, {  
			
				onComplete: function() { 
					images.each(function(imgsrc) {  
						new Element('img',{ src: imgsrc, width: $('background').getWidth(), style: 'width:auto; height:auto;' }).inject($(bg));  				
					});					
					
					$(container).setStyle('opacity', 0);
					bgFull(container, 100);
					
					$(container).removeClass('bg_hide');
					new Fx.Tween($(container)).start('opacity', 0, 1);
				}  
				
			});					
		}
	}

	function updateGalleryPosition()
	{
		var strPosition = "";
		if ($chk($('gallery_pos')))
		{
			if (galleryPos < 10)
				strPosition = "0" + galleryPos;
			else
				strPosition = galleryPos;
			
			$('gallery_pos').set('html', strPosition);
		}
	}

	function galleryMoveNext(max)
	{	
		galleryShow.next();

		galleryPos = parseInt($('gallery_pos').get('html'), 10);
		galleryPos++;

		if (galleryPos > max)
			galleryPos = 1;

		//updateGalleryPosition(galleryPos);
	}

	function galleryMovePrev(max)
	{
		galleryShow.prev();

		galleryPos = parseInt($('gallery_pos').get('html'), 10);
		galleryPos--;

		if (galleryPos < 1)
			galleryPos = max;

		//updateGalleryPosition(galleryPos);
	}

	function makeScrollbar(content,scrollbar,handle,horizontal,ignoreMouse){
		var steps = (horizontal?(content.getScrollSize().x - content.getSize().x):(content.getScrollSize().y - content.getSize().y));

		if (steps > 0)
		{
			var slider = new Slider(scrollbar, handle, {	
				steps: steps,
				mode: (horizontal?'horizontal':'vertical'),
				onChange: function(step){
					// Scrolls the content element in x or y direction.
					var x = (horizontal?step:0);
					var y = (horizontal?0:step);
					content.scrollTo(x,y);
				}
			}).set(0);

			if( !(ignoreMouse) ){
				// Scroll the content element when the mousewheel is used within the
				// content or the scrollbar element.
				$$(content, scrollbar).addEvent('mousewheel', function(e){
					e = new Event(e).stop();
					var step = slider.step - e.wheel * 30;
					slider.set(step);
				});
			}

			if ($chk($$(".scrollPrev"))) 
			{
				$$(".scrollPrev").addEvent('mousedown', function(e) {
					//slider.set(slider.step - 30);
					featureIntervalPrev = scrollContentPrev.periodical(5, slider);
				});
			}

			if ($chk($$(".scrollNext"))) 
			{
				$$(".scrollNext").addEvent('mousedown', function(e) {
					//slider.set(slider.step + 30);
					featureIntervalNext = scrollContentNext.periodical(5, slider);
				});
			}

			if ($chk($$(".scrollPrev"))) 
			{
				$$(".scrollPrev").addEvent('mouseup', function(e) {
					featureIntervalPrev = $clear(featureIntervalPrev);
				});
			}

			if ($chk($$(".scrollNext"))) 
			{
				$$(".scrollNext").addEvent('mouseup', function(e) {
					featureIntervalNext = $clear(featureIntervalNext);
				});
			}

			// Stops the handle dragging process when the mouse leaves the document body.
			$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});
		}
		else
		{
			/*
			var area_scroller = $(scrollbar).getParent('div');
			$(area_scroller).setStyle('display', 'none');
			*/
			$(scrollbar).setStyle('display', 'none');
		}
	}

	//================================================================================================
	// EVENTS FUNCTIONS
	//================================================================================================		
	function setupActions()
	{
		if ($chk($$('.logo_header')))
		{
			$$('.logo_header').addEvents({
				'mouseout' : function(e) {
					$('header_on').setStyle('display', 'none');
					$('header_off').setStyle('display', 'block');
				},
				'mouseover' : function(e) {
					$('header_on').setStyle('display', 'block');
					$('header_off').setStyle('display', 'none');
				}
			});
		}

		if ($chk($$('.logo_about')))
		{
			$$('.logo_about').addEvents({
				'mouseout' : function(e) {
					$('about_on').setStyle('display', 'none');
					$('about_off').setStyle('display', 'block');
				},
				'mouseover' : function(e) {
					$('about_on').setStyle('display', 'block');
					$('about_off').setStyle('display', 'none');
				}
			});
		}

		if($chk($$('.button')))
		{
			$$('.button').addEvents({
				'mouseout' : function() {
					this.setStyle('text-decoration', 'none');
				},
				'mouseover' : function() {
					this.setStyle('text-decoration', 'underline');
				}
			});
		}

		if ($chk($$('.nav_title')))
		{
			$$('.nav_title').addEvents({
				'mouseout' : function() {
					$(this.get('id') + '_off').setStyle('display', 'block');
					$(this.get('id') + '_on').setStyle('display', 'none');
				},
				'mouseover' : function() {
					$(this.get('id') + '_off').setStyle('display', 'none');
					$(this.get('id') + '_on').setStyle('display', 'block');
				}
			});
		}

		//scrollbar on index page
		if ($chk($('dance_style_content')))
		{
			makeScrollbar( $('dance_style_content'), $('dance_style_scrollbar'), $('dance_style_scrollbar_handle'), false, false);
		}
	}

	function setupOpacity()
	{
		if ($chk($$('.block_caption_bg_pink')))
		{
			$$('.block_caption_bg_pink').each(function(el){
				$(el).setOpacity(0.50);
			});
		}

		var browserName = BrowserDetect.browser;
		//check browser

		if (browserName == "Explorer")
		{
			//if IE, change the class

			/*
			.block_content_top_ie
			.block_content_ie
			.block_content_bottom_ie
			.block_content_top_big_ie
			.block_content_big_ie
			.block_content_bottom_big_ie
			.block_content_top_pink_big_ie
			.block_content_pink_big_ie
			.block_content_bottom_pink_big_ie
			.block_content_group_ie
			.block_content_black_ie
			*/

			$$('.block_content_top').each(function(el){
				$(el).removeClass('block_content_top');
				$(el).addClass('block_content_top_ie');
			});

			$$('.block_content').each(function(el){
				$(el).removeClass('block_content');
				$(el).addClass('block_content_ie');
			});

			$$('.block_content_bottom').each(function(el){
				$(el).removeClass('block_content_bottom');
				$(el).addClass('block_content_bottom_ie');
			});

			$$('.block_content_top_280').each(function(el){
				$(el).removeClass('block_content_top_280');
				$(el).addClass('block_content_top_ie_280');
			});

			$$('.block_content_280').each(function(el){
				$(el).removeClass('block_content_280');
				$(el).addClass('block_content_ie_280');
			});

			$$('.block_content_bottom_280').each(function(el){
				$(el).removeClass('block_content_bottom_280');
				$(el).addClass('block_content_bottom_ie_280');
			});

			$$('.block_content_top_big').each(function(el){
				$(el).removeClass('block_content_top_big');
				$(el).addClass('block_content_top_big_ie');
			});

			$$('.block_content_big').each(function(el){
				$(el).removeClass('block_content_big');
				$(el).addClass('block_content_big_ie');
			});

			$$('.block_content_bottom_big').each(function(el){
				$(el).removeClass('block_content_bottom_big');
				$(el).addClass('block_content_bottom_big_ie');
			});

			$$('.block_content_top_pink_big').each(function(el){
				$(el).removeClass('block_content_top_pink_big');
				$(el).addClass('block_content_top_pink_big_ie');
			});

			$$('.block_content_pink_big').each(function(el){
				$(el).removeClass('block_content_pink_big');
				$(el).addClass('block_content_pink_big_ie');
			});

			$$('.block_content_bottom_pink_big').each(function(el){
				$(el).removeClass('block_content_bottom_pink_big');
				$(el).addClass('block_content_bottom_pink_big_ie');
			});

			$$('.block_content_group').each(function(el){
				$(el).removeClass('block_content_group');
				$(el).addClass('block_content_group_ie');
			});

			$$('.block_content_black').each(function(el){
				$(el).removeClass('block_content_black');
				$(el).addClass('block_content_black_ie');
			});
		}

		if ($chk($('main_content_events')))
		{
			if (browserName != "Explorer")
			{
				//other than IE, add the class to activate the transparent background
				$('main_content_events').addClass('bg_transparent_white');
			}
			else
			{
				//if IE, unhide the background div, and then do the processing
				var wrapperHeight = $('main_content_events').getHeight();
				//alert(wrapperMainHeight);
				$('main_background_events').setStyle('display', 'block');
				$('main_background_events').setStyle('height', wrapperHeight + 'px');
				$('main_content_events').setStyle('margin-top', '-' + wrapperHeight + 'px');
			}
		}
	}

	function setupSlideshows()
	{
		if($chk($('rotating_images_events_2')))
		{
			var myShow = new Slideshow('rotating_images_events_2', false, { delay: 5000, width: 250, height: 290 });
		}

		if($chk($('rotating_images_events')))
		{
			var myShow = new Slideshow('rotating_images_events', false, { delay: 5000, width: 250, height: 290 });
		}

		if($chk($('rotating_images_index')))
		{
			var data = {
				'img_home_2.jpg': { caption: 'Dalena & Hooman.' },
				'img_home.jpg': { caption: 'Audrey & Pete.' }
			};
			var myShow = new Slideshow('rotating_images_index', data, { captions: true, delay: 5000, width: 560, height: 475, hu: 'images/site/'});
		}

		if($chk($('rotating_images')))
		{
			//'img_styles_1.jpg': { caption: 'Samantha - Cha Cha.' },
			var data = {
				'img_styles_2.jpg': { caption: 'Pete & Audrey - Ballroom.' },
				'img_styles_3.jpg': { caption: 'Annmarie - Latin.' },
				'img_styles_4.jpg': { caption: 'Katie & Grant - Rumba.' },
				'img_styles_5.jpg': { caption: 'Pete & Barbara - English Tango.' }
			};
			var myShow = new Slideshow('rotating_images', data, { captions: true, delay: 5000, width: 270, height: 475, hu: 'images/site/'});
		}

		if($chk($('rotating_gallery_images')))
		{
			var data = {
				'1.jpg': { caption: 'The Opening.' },
				'2.jpg': { caption: 'The Opening.' },
				'3.jpg': { caption: 'The Opening.' },
				'4.jpg': { caption: 'The Opening.' },
				'5.jpg': { caption: 'The Opening.' },
				'6.jpg': { caption: 'The Opening.' },
				'7.jpg': { caption: 'The Opening.' },
				'8.jpg': { caption: 'The Opening.' },
				'9.jpg': { caption: 'The Opening.' },
				'10.jpg': { caption: 'The Opening.' },
				'11.jpg': { caption: 'The Opening.' },
				'12.jpg': { caption: 'The Opening.' },
				'13.jpg': { caption: 'The Opening.' },
				'14.jpg': { caption: 'The Opening.' },
				'15.jpg': { caption: 'The Opening.' },
				'16.jpg': { caption: 'The Opening.' },
				'17.jpg': { caption: 'The Opening.' },
				'18.jpg': { caption: 'The Opening.' },
				'19.jpg': { caption: 'The Opening.' },
				'20.jpg': { caption: 'The Opening.' },
				'21.jpg': { caption: 'The Opening.' },
				'22.jpg': { caption: 'The Opening.' },
				'23.jpg': { caption: 'The Opening.' },
				'24.jpg': { caption: 'The Opening.' },
				'25.jpg': { caption: 'The Opening.' },
				'26.jpg': { caption: 'The Opening.' },
				'27.jpg': { caption: 'The Opening.' },
				'28.jpg': { caption: 'The Opening.' },
				'29.jpg': { caption: 'The Opening.' },
				'30.jpg': { caption: 'The Opening.' },
				'31.jpg': { caption: 'The Opening.' },
				'32.jpg': { caption: 'The Opening.' },
				'33.jpg': { caption: 'The Opening.' },
				'34.jpg': { caption: 'The Opening.' },
				'35.jpg': { caption: 'The Opening.' },
				'36.jpg': { caption: 'The Opening - Speeches.' },
				'37.jpg': { caption: 'The Opening.' },
				'38.jpg': { caption: 'The Opening.' },
				'39.jpg': { caption: 'The Opening.' },
				'40.jpg': { caption: 'The Opening.' },
				'41.jpg': { caption: 'The Opening.' },
				'42.jpg': { caption: 'The Opening.' },
				'43.jpg': { caption: 'The Opening.' },
				'44.jpg': { caption: 'The Opening.' },
				'45.jpg': { caption: 'The Opening.' },
				'46.jpg': { caption: 'The Opening.' },
				'47.jpg': { caption: 'The Opening.' },
				'48.jpg': { caption: 'The Opening.' },
				'49.jpg': { caption: 'The Opening - The Hit the Floor team. Melanie, Lauren, Pete, Annmarie, Sortira and Stewart. ' },
				'50.jpg': { caption: 'The Opening.' }
			};

			var random = $random(0, 49);
			//var random = 7;

			galleryShow = new Slideshow('rotating_gallery_images', data, { onComplete: function(){ updateGalleryPosition(); }, linked: true, captions: true, delay: 2000, width: 560, height: 475, hu: 'images/gallery' });
			galleryShow.pause(1);
			galleryShow.go(random);
			galleryPos = random + 1;
			updateGalleryPosition();
		}

		if($chk($('rotating_gallery_images_2')))
		{
			var data = {
				'1.jpg': { caption: 'Christmas Party 2009.' },
				'2.jpg': { caption: 'Christmas Party 2009.' },
				'3.jpg': { caption: 'Christmas Party 2009.' },
				'4.jpg': { caption: 'Christmas Party 2009.' },
				'5.jpg': { caption: 'Christmas Party 2009.' },
				'6.jpg': { caption: 'Christmas Party 2009.' },
				'7.jpg': { caption: 'Christmas Party 2009.' },
				'8.jpg': { caption: 'Christmas Party 2009.' },
				'9.jpg': { caption: 'Christmas Party 2009.' },
				'10.jpg': { caption: 'Christmas Party 2009.' },
				'11.jpg': { caption: 'Christmas Party 2009.' },
				'12.jpg': { caption: 'Christmas Party 2009.' },
				'13.jpg': { caption: 'Christmas Party 2009.' },
				'14.jpg': { caption: 'Christmas Party 2009.' },
				'15.jpg': { caption: 'Christmas Party 2009.' },
				'16.jpg': { caption: 'Christmas Party 2009.' },
				'17.jpg': { caption: 'Christmas Party 2009.' },
				'18.jpg': { caption: 'Christmas Party 2009.' },
				'19.jpg': { caption: 'Christmas Party 2009.' },
				'20.jpg': { caption: 'Christmas Party 2009.' },
				'21.jpg': { caption: 'Christmas Party 2009.' },
				'22.jpg': { caption: 'Christmas Party 2009.' },
				'23.jpg': { caption: 'Christmas Party 2009.' },
				'24.jpg': { caption: 'Christmas Party 2009.' },
				'25.jpg': { caption: 'Christmas Party 2009.' },
				'26.jpg': { caption: 'Christmas Party 2009.' },
				'27.jpg': { caption: 'Christmas Party 2009.' },
				'28.jpg': { caption: 'Christmas Party 2009.' },
				'29.jpg': { caption: 'Christmas Party 2009.' },
				'30.jpg': { caption: 'Christmas Party 2009.' },
				'31.jpg': { caption: 'Christmas Party 2009.' },
				'32.jpg': { caption: 'Christmas Party 2009.' },
				'33.jpg': { caption: 'Christmas Party 2009.' },
				'34.jpg': { caption: 'Christmas Party 2009.' },
				'35.jpg': { caption: 'Christmas Party 2009.' }
			};

			var random = $random(0, 34);
			//var random = 7;

			galleryShow = new Slideshow('rotating_gallery_images_2', data, { onComplete: function(){ updateGalleryPosition(); }, linked: true, captions: true, delay: 2000, width: 560, height: 475, hu: 'images/gallery_2' });
			galleryShow.pause(1);
			galleryShow.go(random);
			galleryPos = random + 1;
			updateGalleryPosition();
		}

		if($chk($('rotating_gallery_images_3')))
		{
			var data = {
				'1.jpg': { caption: 'Open Day 2010.' },
				'2.jpg': { caption: 'Open Day 2010.' },
				'3.jpg': { caption: 'Open Day 2010.' },
				'4.jpg': { caption: 'Open Day 2010.' },
				'5.jpg': { caption: 'Open Day 2010.' },
				'6.jpg': { caption: 'Open Day 2010.' },
				'7.jpg': { caption: 'Open Day 2010.' },
				'8.jpg': { caption: 'Open Day 2010.' },
				'9.jpg': { caption: 'Open Day 2010.' },
				'10.jpg': { caption: 'Open Day 2010.' },
				'11.jpg': { caption: 'Open Day 2010.' },
				'12.jpg': { caption: 'Open Day 2010.' },
				'13.jpg': { caption: 'Open Day 2010.' },
				'14.jpg': { caption: 'Open Day 2010.' },
				'15.jpg': { caption: 'Open Day 2010.' },
				'16.jpg': { caption: 'Open Day 2010.' },
				'17.jpg': { caption: 'Open Day 2010.' },
				'18.jpg': { caption: 'Open Day 2010.' },
				'19.jpg': { caption: 'Open Day 2010.' },
				'20.jpg': { caption: 'Open Day 2010.' },
				'21.jpg': { caption: 'Open Day 2010.' },
				'22.jpg': { caption: 'Open Day 2010.' },
				'23.jpg': { caption: 'Open Day 2010.' },
				'24.jpg': { caption: 'Open Day 2010.' },
				'25.jpg': { caption: 'Open Day 2010.' },
				'26.jpg': { caption: 'Open Day 2010.' },
				'27.jpg': { caption: 'Open Day 2010.' },
				'28.jpg': { caption: 'Open Day 2010.' },
				'29.jpg': { caption: 'Open Day 2010.' },
				'30.jpg': { caption: 'Open Day 2010.' },
				'31.jpg': { caption: 'Open Day 2010.' },
				'32.jpg': { caption: 'Open Day 2010.' },
				'33.jpg': { caption: 'Open Day 2010.' },
				'34.jpg': { caption: 'Open Day 2010.' },
				'35.jpg': { caption: 'Open Day 2010.' },
				'36.jpg': { caption: 'Open Day 2010.' },
				'37.jpg': { caption: 'Open Day 2010.' },
				'38.jpg': { caption: 'Open Day 2010.' },
				'39.jpg': { caption: 'Open Day 2010.' },
				'40.jpg': { caption: 'Open Day 2010.' },
				'41.jpg': { caption: 'Open Day 2010.' },
				'42.jpg': { caption: 'Open Day 2010.' },
				'43.jpg': { caption: 'Open Day 2010.' },
				'44.jpg': { caption: 'Open Day 2010.' },
				'45.jpg': { caption: 'Open Day 2010.' },
				'46.jpg': { caption: 'Open Day 2010.' },
				'47.jpg': { caption: 'Open Day 2010.' },
				'48.jpg': { caption: 'Open Day 2010.' },
				'49.jpg': { caption: 'Open Day 2010.' },
				'50.jpg': { caption: 'Open Day 2010.' },
				'51.jpg': { caption: 'Open Day 2010.' },
				'52.jpg': { caption: 'Open Day 2010.' },
				'53.jpg': { caption: 'Open Day 2010.' },
				'54.jpg': { caption: 'Open Day 2010.' },
				'55.jpg': { caption: 'Open Day 2010.' }
			};

			var random = $random(0, 54);
			//var random = 7;

			galleryShow = new Slideshow('rotating_gallery_images_3', data, { onComplete: function(){ updateGalleryPosition(); }, linked: true, captions: true, delay: 2000, width: 560, height: 475, hu: 'images/gallery_3' });
			galleryShow.pause(1);
			galleryShow.go(random);
			galleryPos = random + 1;
			updateGalleryPosition();
		}
	}

	function resetFooterPosition()
	{
		//set wrapper footer's height
		if ($chk($('wrapper_footer')))
		{
			var wrapperMainHeight = $('wrapper_main').getHeight();
			var h = window.getHeight() - wrapperMainHeight;
	
			if (h<45)
			{
				h = 45;
				$('wrapper_main').setStyle('padding-bottom', '23px');
				$('wrapper_main').setStyle('margin-bottom', '23px');
			}
			else
			{
				$('wrapper_main').setStyle('padding-bottom', '0px');
				$('wrapper_main').setStyle('margin-bottom', '0px');
			}
	
			$('wrapper_footer').setStyle('height', h + 'px');
			$('footer_content').setStyle('height', h + 'px');

			//set footer_content left position
			var w = $('iefix').getWidth();
			var wLeft = (w - 890) / 2;
			wLeft = wLeft + 5;
			$('footer_content').setStyle('left', wLeft + 'px');
		}
		//alert($('iefix').getWidth());
	}

	//================================================================================================
	// SCALLING BACKGROUND
	//================================================================================================		
	function $E(tag,el){return $(el||document).getElement(tag)}
	
	kina={
		doc:{x:0,y:0},
		fix:
			function()
			{				
				if(kina.bg.complete&&(db.offsetWidth!=kina.doc.x||db.offsetHeight!=kina.doc.y||kina.fix.src!=kina.bg.src))
				{
					var bg=kina.bg.getSize();
					kina.doc={x:db.offsetWidth,y:db.offsetHeight};
					kina.fix.src==kina.bg.src||$extend(kina.fix,{p:bg.x/bg.y,src:kina.bg.src});
					kina.bg.setStyles({width:(bg.y=kina.doc.x>(bg.x=Math.round(kina.doc.y*kina.fix.p)))?kina.doc.x:bg.x,height:bg.y?Math.round(kina.doc.x/kina.fix.p):kina.doc.y})			
				}								
			}
	}	
	
	function bgFull(container, interval)
	{
		if ($chk($(container)))
		{
			$extend
			(
				kina,{bg:$E('img',$E('#' + container,db=$(document.body))),timer:setInterval(kina.fix,interval)}
			);			
		}		
	}	
	
	//================================================================================================
	// START THIS WHEN PAGE DOM READY
	//================================================================================================		
	window.addEvents({
	
		'domready' : function(e) {
			BrowserDetect.init();
			setupActions();
			setupOpacity();
			setupSlideshows();
			initBackgrounds();
			resetFooterPosition();
		},
		
		'resize' : function() {
			resetFooterPosition();
		}
		
	});
	

//-->
