$(document).ready(function(){
	prepareGallery();
	preparePop();
	//flash();
})

function inputFocus(a, b) {
	if (a.value == b) (a.value = ''); 
}

function inputBlur(a, b) {
	if (a.value == '') (a.value = b);
}

var Timer;
function ScrollLeft(e) {
	Timer = setInterval(function(){document.getElementById(e).scrollLeft -= 20}, 15)
}

function ScrollRight(e) {
	Timer = setInterval(function(){document.getElementById(e).scrollLeft += 20}, 15)
}

function prepareGallery(){
	$('#images a:last').css('margin-right', '0')
}

function preparePop(){
	$('#closeBtn').click(function(){$('#popup').css('visibility', 'hidden');return false});
}

function scrolledTop(){
	return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop)
}

function clientHeight(){
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}


function getCurrentPos(eThis) {
	var current = eThis;
	var currentTop = 0;
	var currentLeft = 0;
	var currentHeight = current.offsetHeight;
	var currentWidth = current.offsetWidth;

	while (current) {
		currentLeft += current.offsetLeft;
		currentTop += current.offsetTop;
		current = current.offsetParent;
	}
	return {left:currentLeft, top:currentTop, width:currentWidth, height:currentHeight};
}

function showPop(eThis, objId) {
	var obj = $('#'+objId) ? $('#'+objId) : objId;
	var objHeight = parseInt(obj.css('height'))
	/*$.each($.browser, function(i) {
		if($.browser.msie && $.browser.version < 7.0) {
			obj.css('height', $('body').attr('offsetHeight') - 550);
		} else {
			obj.css('height', $('body').attr('offsetHeight') - 150);
		}
	});*/
	$('#popup').css('top', 50);
	obj.css('visibility', 'visible');
}

function flash(){
	if($('#head')) {
		var params = {	menu: "false", allowScriptAccess: "sameDomain", wmode : "transparent" };
		swfobject.embedSWF("/img/head.swf", "head", "976", "310", "9", "", false, params, false);
	}
}
