/* *********************************************** */	
/*               flexslider start                  */
/* *********************************************** */
var speed = 50;
var pic, numImgs, arrLeft, i, totalWidth, n, myInterval; 

$(window).load(function(){
	pic = $("#slider").find("img");
	numImgs = pic.length;
	arrLeft = new Array(numImgs);

	for (i=0;i<numImgs;i++){

		totalWidth=0;
		for(n=0;n<i;n++){
			totalWidth += $(pic[n]).width();
		}

		arrLeft[i] = totalWidth;
		$(pic[i]).css("left",totalWidth);
	}

	myInterval = setInterval("flexiScroll()",speed);
	$('#imageloader').hide();
	$(pic).show();
});

function flexiScroll(){

	for (i=0;i<numImgs;i++){
		arrLeft[i] -= 1;		

		if (arrLeft[i] == -($(pic[i]).width())){
			totalWidth = 0;
			for (n=0;n<numImgs;n++){
				if (n!=i){
					totalWidth += $(pic[n]).width();
				}
			}
			arrLeft[i] =  totalWidth;
		}
		$(pic[i]).css("left",arrLeft[i]);
	}
}
/* *********************************************** */	
/*               flexslider end                    */
/* *********************************************** */

$(window).load(function(){
	$("a.grouped_elements").fancybox();
});

/* *********************************************** */	
/*        function for placeholders start          */
/* *********************************************** */
function activatePlaceholders() {
	var detect = navigator.userAgent.toLowerCase();
	if (detect.indexOf("safari") > 0) return false;
	var inputs = document.getElementsByTagName("input");
	for (var i=0;i<inputs.length;i++) {
	  if (inputs[i].getAttribute("type") == "text") {
	   if (inputs[i].getAttribute("placeholder") && inputs[i].getAttribute("placeholder").length > 0) {
		inputs[i].value = inputs[i].getAttribute("placeholder");
		inputs[i].onclick = function() {
		 if (this.value == this.getAttribute("placeholder")) {
		  this.value = "";
		 }
		 return false;
		}
		inputs[i].onblur = function() {
		 if (this.value.length < 1) {
		  this.value = this.getAttribute("placeholder");
		 }
		}
	   }
	  }
	}
}
/* activate function directly */
window.onload=function() {
	activatePlaceholders();
}
/* *********  END  ********** */
/* *********************************************** */	
/*        function for placeholders end          */
/* *********************************************** */
