$(document).ready(function(){
	$("#btn-login").click(function () { 
		var thsH = findPosY(document.getElementById("log-in")) - 65;
		var str = thsH + 'px';
		document.logInForm.e.select();
		$.scrollTo(str, 500, { axis:'y' });
	});
	$("#btn-aboutus").click(function () { 
		var thsH = findPosY(document.getElementById("about-us")) - 65;
		var str = thsH + 'px';
		$.scrollTo(str, 500, { axis:'y' });
	});
	$("#btn-services").click(function () { 
		var thsH = findPosY(document.getElementById("services")) - 65;
		var str = thsH + 'px';
		$.scrollTo(str, 500, { axis:'y' });
	});
	$("#btn-products").click(function () { 
		var thsH = findPosY(document.getElementById("products")) - 65;
		var str = thsH + 'px';
		$.scrollTo(str, 500, { axis:'y' });
	});
	
	$("#btn-home").click(function () { 
		$.scrollTo(0, 500, { axis:'y' });
	});
});

function logIn() {
	var lF = document.forms.logInForm;
	
	with (lF) {
		var e = e.value;
		var p = p.value;
	}
	
	$.ajax({
		url: "pages/logIn.html",
		cache: false,
		success: function(html){
			$("#log-in-eMsg").html(html);
			$("#log-in-eMsg").slideDown();
			setTimeout('$("#log-in-eMsg").slideUp();', 5000);
		}
	});
	
}

function setFl() {
	var fl = document.getElementById("flower");
	fl.style.top = getScrollHeight() + 'px';
}

function getScrollHeight() {
	var h = window.pageYOffset ||
	document.body.scrollTop ||
	document.documentElement.scrollTop;

	return h ? h : 0;
}

function findPosY(obj) {
	var curtop = 0;
	if(obj.offsetParent)
	while(1) {
		curtop += obj.offsetTop;
		if(!obj.offsetParent)
		break;
		obj = obj.offsetParent;
	}
	else if(obj.y)
	curtop += obj.y;
	return curtop;
}