var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-10774598-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['_setDomainName', 'www.st-cyprien-plage-location.fr']);
(function() {
	var ga = document.createElement('script');
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	ga.setAttribute('async', 'true');
	document.documentElement.firstChild.appendChild(ga);
})();
window.addEvent('domready', function() {
	//var data = shuffle(['p_header.jpg', 'p_header7.jpg', 'p_header2.jpg', 'p_header3.jpg', 'p_header4.jpg', 'p_header5.jpg', 'p_header6.jpg', 'p_header7.jpg', 'p_header8.jpg', 'p_header9.jpg', 'p_header10.jpg', 'p_header11.jpg']);
	var data = getSlideArray();
	var myShow = new Slideshow('show', data, { delay: 5000, duration: 1250 , hu: '/images/slideshow', height: 258, width: 1000 });
	if(PicLensLite.hasClient()) {
		$('piclensButtonId').style.display='block';
	}
});
window.addEvent('unload', function() {
	$('lightbox').setStyle('display', 'block');
});
function getSlideArray() {
	data=new Array(17)
	for (i=0;i<data.length;i++) {
		data[i]=i+'.jpg';
	}
	return shuffle(data);
}
shuffle = function(o){ //v1.0
	for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
	return o;
};

function describeObj(o, limit) {
	if (typeof optional == "undefined") {
		limit = 50;
	}
	var strO = '';
	var i=0;
	for (var key in o)
	{
		if ((i % limit)==0 && i>0) {
			alert(strO);
			strO = '';
		}
		strO += i+" : "+key+" => "+o[key]+"\n";
		i++;
	}
	if (strO.length > 0) {
		alert(strO);
	}	
}

String.prototype.toProperCase = function(){
     return this.toLowerCase().replace(/\w+/g,function(s){
          return s.charAt(0).toUpperCase() + s.substr(1);
     })
}
function getId(id) {
	return document.getElementById(id);
}

function isEmailValid(emailadr)
{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	return (filter.test(emailadr))
}
function setSelectionRange(input, selectionStart, selectionEnd) {
	if (input.setSelectionRange) {
		input.focus();
		input.setSelectionRange(selectionStart, selectionEnd);
	}
	else if (input.createTextRange) {
		var range = input.createTextRange();
		range.collapse(true);
		range.moveEnd('character', selectionEnd);
		range.moveStart('character', selectionStart);
		range.select();
	}
}
function setCaretToEnd (input) {
	setSelectionRange(input, input.value.length, input.value.length);
}

function createInfoMarker(point, address) {
	var marker = new GMarker(point);
	GEvent.addListener(marker, "click",	function() {
			marker.openInfoWindowHtml(address);
	});
return marker;
}
function fontSizeUp(idname) {
	var fontSize = parseInt($(idname).getStyle('fontSize'));
	$(idname).setStyle('fontSize', fontSize+10+"%");
	Cookie.write("fontSize", fontSize, {duration: 15});
}
function fontSizeDown(idname) { 
	var fontSize = parseInt($(idname).getStyle('fontSize'));
	$(idname).setStyle('fontSize', fontSize-10+"%");
	Cookie.write("fontSize", fontSize, {duration: 15});
}

function getOffsetPosition(inID, inTYPE)
{
 var posValue = 0;
 var oObj = document.getElementById(inID);
 var sType = 'oObj.offset' + inTYPE;
 while (oObj && oObj.tagName != 'BODY') {
  posValue += eval(sType);
  oObj = oObj.offsetParent;
 }
 return (posValue);
}

