/**
 * Konkurs Rezerwuj hotel i zgarniaj nagrody !
 * @version 0.1
 * @author lkieres
 */

// Mamy starego Jquery :/ - potrzebne funkcje do slidera

// Create innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function(i, name){

	var tl = i ? "Left"  : "Top",  // top or left
		br = i ? "Right" : "Bottom"; // bottom or right

	// innerHeight and innerWidth
	jQuery.fn["inner" + name] = function(){
		return this[ name.toLowerCase() ]() +
			num(this, "padding" + tl) +
			num(this, "padding" + br);
	};

	// outerHeight and outerWidth
	jQuery.fn["outer" + name] = function(margin) {
		return this["inner" + name]() +
			num(this, "border" + tl + "Width") +
			num(this, "border" + br + "Width") +
			(margin ?
				num(this, "margin" + tl) + num(this, "margin" + br) : 0);
	};
});


if (document.all && /MSIE (5\.5|6)/.test(navigator.userAgent)) {
	document.write(unescape("%3Clink rel='stylesheet' type='text/css' href='/styles/contest-ie6styles.css' media='screen' /%3E"));
}

if (document.all && /MSIE (7)/.test(navigator.userAgent)) {
	document.write(unescape("%3Clink rel='stylesheet' type='text/css' href='/styles/contest-ie7styles.css' media='screen' /%3E"));
}

// Helper function used by the dimensions and offset modules
function num(elem, prop) {
	return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
}

$(document).ready(function(){
	
	// fix dla IE6
	if (jQuery.browser.msie && jQuery.browser.version == 6) {  var width = $(window).width();  var height = $(window).height();  var pageHeight = document.body.clientHeight;  if (pageHeight > height) {  height = pageHeight;  }  $("#overlay").css({width: width, height: height});  } 

	$.validator.addMethod(
	        "regex",
	        function(value, element, regexp) {
	            var check = false;
	            var re = new RegExp(regexp);
	            return this.optional(element) || re.test(value);
	        },
	        "Proszę wprowadzić poprawną wartość."
	);


});

