//<!--


var glA = document.all ? true:false;
if (!glA) var glGE = document.getElementById ? true:false; else var glGE = false;
var glW = 0;
var glH = 0;
var img_loaded = false;

// document.oncontextmenu=new Function("alert('OOPS\\n Tato funkce je zakázána na těchto stránkách.\\n This functionality is restricted on this pages.'); return false;");


// vypina div pomoci idcka
function hideElement(x_id)
{
	if (glA) { el=document.all(x_id).style; } else { el=document.getElementById(x_id).style; }
	el.display='none';
}


// zapina div pomoci idcka
function showElement(x_id)
{
	if (glA) { el=document.all(x_id).style; } else { el=document.getElementById(x_id).style; }
	el.display='block';
}


function zapniSubmenu(xid){ //v3.0
	if ( glA ) {
		document.all[ xid ].style.display = "block";
	} else if ( glGE ) {
		document.getElementById ( xid ).style.display = "block";
	}
}

function switch_contact(selObj,restore){ //v3.0
	if ( glA ) {
		document.all[ 'd-contact-cz' ].style.display = "none";
		document.all[ 'd-contact-de' ].style.display = "none";
		document.all[ 'd-contact-us' ].style.display = "none";
		document.all[ selObj.options[selObj.selectedIndex].value ].style.display = "block";
		/* alert (document.all[ layer_id ].style.display); */
	} else if ( glGE ) {
		document.getElementById ( 'd-contact-cz' ).style.display = "none";
		document.getElementById ( 'd-contact-de' ).style.display = "none";
		document.getElementById ( 'd-contact-us' ).style.display = "none";
		document.getElementById ( selObj.options[selObj.selectedIndex].value ).style.display = "block";
		/* alert (document.getElementById ( layer_id ).style.display); */
	}
	if (restore) selObj.selectedIndex=0;
}


function switch_gallery( layer_id ) {
	if ( glA ) {
		document.all[ 'd-gal-vyr' ].style.display = "none";
		document.all[ 'd-gal-promo' ].style.display = "none";
		document.all[ 'd-gal-vele' ].style.display = "none";
		document.all[ 'd-gal-int' ].style.display = "none";
		document.all[ layer_id ].style.display = "block";
		/* alert (document.all[ layer_id ].style.display); */
	} else if ( glGE ) {
		document.getElementById ( 'd-gal-vyr' ).style.display = "none";
		document.getElementById ( 'd-gal-promo' ).style.display = "none";
		document.getElementById ( 'd-gal-vele' ).style.display = "none";
		document.getElementById ( 'd-gal-int' ).style.display = "none";
		document.getElementById ( layer_id ).style.display = "block";
		/* alert (document.getElementById ( layer_id ).style.display); */
	}
}


// preloaduje obrazkyu do document.images
function im_preload( img_obj, img_src )
{
	if ( document.images ) {
		eval( img_obj + ' = new Image()' );
		eval( img_obj + '.src = "' + img_src + '"' );
	}
}


// meni obrazky v hladine LAYER a jejim <IMG> s Id nebo Name IMG_NAME za obrazek ulozeni v objektu IMG_OBJ z kontejneru document.images
function im_change( layer, img_name, img_obj ) {
	if (img_loaded) {
		// alert( layer + '   ' + img_name + '    ' + img_obj);
		if ( document.images ) {
			if ( document.layers && layer != null ) eval( 'document.layers["' + layer + '"].document.images["' + img_name + '"].src = ' + img_obj + '.src');
			else document.images[ img_name ].src = eval( img_obj + ".src" );
			}
		}
	}

	
// - - - object JS changer for pics
function image_changer ( xImgId, xImgObjOver, xImgObjOut )
{
	this.imgId = xImgId;
	this.imgObjOver = xImgObjOver;
	this.imgObjOut = xImgObjOut;
}


image_changer.prototype.onOver = function()
{
	im_change( null, this.imgId, this.imgObjOver );
}


image_changer.prototype.onOut = function()
{
	im_change( null, this.imgId, this.imgObjOut );
}


// nacte rozliseni browseru do globalnich promennych glW a glH
function get_scr_res() {
	if ( glGE ) {
		glW = window.innerWidth;
		glH = window.innerHeight;
		}
	else if ( glA ) {
		glW = document.body.offsetWidth;
		glH = document.body.offsetHeight;
		}
	}

	
var pop_pic_params = 'directories=no,location=no,menubars=no,menubar=no,resizable=yes,scrollbars=yes,statusbars=no,status=no,toolbar=no'; // ,fullscreen=no,titlebar=no

// popne picture
function popUpPic(URL,s,v) {
	var corMw = 8;
	var corMh = 28;
	if (document.GetElementById) { s += corMw; v += corMh; }
	s += 10;
	v += 25;
	
	if (parseInt(navigator.appVersion) >= 4) { winl = 100, wint = 100; }
	var winl = (screen.width - s) / 2;
	var wint = (screen.height - v) / 2;
	
	day = new Date();
	id = day.getTime();
	eval ("page" + id + " = window.open('" + URL + "','" + id + "','" + pop_pic_params + ",width="+s+",height="+v+",left="+winl+",top="+wint+"');");
	// HTML
	eval ("page" + id + ".document.writeln('<html><head><title>SYMBIO Design image library</title>');");
	eval ("page" + id + ".document.writeln('<script type=\"text/javascript\" language=\"Javascript\">window.resizeTo(" + s +  "," + v + "); window.moveTo(" + winl + ", " +  wint + ")	; document.oncontextmenu=new Function(\"return false;\");</script>');");
	eval ("page" + id + ".document.writeln('<style>BODY { background-color : #FFFFFF; overflow : hidden; } IMG { border-color : #AAAAAA;}</style>');");
	eval ("page" + id + ".document.oncontextmenu=new Function(\"alert('OOPS\\\\n Tato funkce je zakázána na těchto stránkách.\\\\n This functionality is restricted on this pages.'); return false;\");");
	eval ("page" + id + ".document.writeln('</head>');");
	eval ("page" + id + ".document.write('<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" border=\"#7F7F7F\">');");
	eval ("page" + id + ".document.write('<a href=\"#\" onClick=\"javascript:window.close();\" onFocus=\"window.focus();\">');");
	eval ("page" + id + ".document.write('<img src=" + URL + " alt=\"Click on image to close the window.\" border=\"1\" GALLERYIMG=\"false\">');");
	eval ("page" + id + ".document.write('</A>');");
	eval ("page" + id + ".document.writeln('</body>');");
	eval ("page" + id + ".document.writeln('</html>');");
}

function popPhpPic(URL, comment) {
	var s=160;
	var v=120;	
	var corMw = 8;
	var corMh = 28;
	if (document.GetElementById) { s += corMw; v += corMh; }
	s += 10;
	v += 25;
	
	if (parseInt(navigator.appVersion) >= 4) { winl = 100, wint = 100; }
	var winl = (screen.width - s) / 2;
	var wint = (screen.height - v) / 2;
	
	if (gl_lang) lang=gl_lang; else lang='cz';
	
	day = new Date();
	id = day.getTime();
	popPhpPic_URL = 'tp_pic.php?urlpic=' + URL + '&gl_lang=' + lang + '&title=' + comment;
	popPhpPic_id = 'PHPpicture';
	popPhpPic_params = pop_pic_params +',width='+s+",height="+v+",left="+winl+",top="+wint;
	window.open( popPhpPic_URL, popPhpPic_id, popPhpPic_params);
}

function popGallery(URL, comment_cz, comment_en) {
	var s=200;
	var v=200;	
	if (parseInt(navigator.appVersion) >= 4) { winl = 100, wint = 100; }
	var winl = (screen.width - s) / 2;
	var wint = (screen.height - v) / 2;

	if (gl_lang) lang=gl_lang; else lang='cz';
	
	day = new Date();
	id = day.getTime();
	popPhpPic_URL = 'tp_pop_gallery.php?urlpic=' + URL + '&gl_lang=' + lang + '&comment_cz=' + comment_cz + '&comment_en=' + comment_en;
	popPhpPic_id = 'PHPpicture';
	popPhpPic_params = pop_pic_params +',width='+s+",height="+v+",left="+winl+",top="+wint;
	window.focus();
	window.open( popPhpPic_URL, popPhpPic_id, popPhpPic_params);
}

// -->
