function gallery(url){
	var parameter="toolbar=no,scrollbars=yes,status=no,resizable=yes,width=770,height=550";
	okno=window.open(url,"gallery",parameter);
}

function showOrder(){
	document.getElementById('oul').style.display = "block";
	orderOpen = true;
}
function hideOrder(){
	orderOpen = false;
	setTimeout('hideOrderMenu()',1000);
}
function onOrder(){
	orderOpen = true;
	//alert('on');
}
function offOrder(){
	orderOpen = false;
	setTimeout('hideOrderMenu()',1000);
}

function hideOrderMenu(){
	if(typeof(orderOpen) != 'undefined') {
		if(orderOpen) return false;
		else document.getElementById('oul').style.display = "none";
	}
	else document.getElementById('oul').style.display = "none";
}

function showDown(){
	document.getElementById('oud').style.display = "block";
	downOpen = true;
}
function hideDown(){
	downOpen = false;
	setTimeout('hideDownMenu()',100);
}
function onDown(){
	downOpen = true;
	//alert('on');
}
function offDown(){
	downOpen = false;
	setTimeout('hideDownMenu()',100);
}

function hideDownMenu(){
	if(typeof(downOpen) != 'undefined') {
		if(downOpen) return false;
		else document.getElementById('oud').style.display = "none";
	}
	else document.getElementById('oud').style.display = "none";
}



function frontBanner(){
	var fseen = readCookie('fbp');
	if(!fseen) {

		if(document.getElementById("shb")){
			hideSelectBoxes();
			hideFlash();

			var fb = document.getElementById('fbanner');
			fb.style.display = 'block';

			var arrayPageSize = getPageSize();
			fb.style.width = arrayPageSize[0]+"px";
			fb.style.height = arrayPageSize[1]+"px";
			//alert(arrayPageSize[1]);

			var fO = fb.getElementsByTagName("object");
			for (i = 0; i < fO.length; i++) {
				fO[i].style.visibility = "visible";
			}
			var fE = fb.getElementsByTagName("embed");
			for (i = 0; i < fE.length; i++) {
				fE[i].style.visibility = "visible";
			}
			createCookie('fbp',1);
		}
	}
}

function hideFrontBanner(){
	showSelectBoxes();
	showFlash();
	document.getElementById('fbanner').style.display = 'none';
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function Get_Cookie( name ) {
	
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) &&
	( name != document.cookie.substring( 0, name.length ) ) )
	{
	return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}


function eraseCookie(name) {
	createCookie(name,"",-1);
}

function showBanner(pos,ban){
	var seen = readCookie('bp' + pos);
	if(seen) seen = seen + '~' + ban;
	else seen = ban;
	createCookie('bp' + pos,seen,1);
}
function resetBanner(pos){
	eraseCookie('bp' + pos);
}




function getPageScroll(){

	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}




function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
//	console.log(self.innerWidth);
//	console.log(document.documentElement.clientWidth);

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

//	console.log("xScroll " + xScroll)
//	console.log("windowWidth " + windowWidth)

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
//	console.log("pageWidth " + pageWidth)

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


// ------------------------------------------------


function showSelectBoxes(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}

// ---------------------------------------------------

function hideSelectBoxes(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}

// ---------------------------------------------------

function showFlash(){
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "visible";
	}

	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "visible";
	}
}

// ---------------------------------------------------

function hideFlash(){
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "hidden";
	}

	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "hidden";
	}

}









