function open_wnd(url, width, height)
{
	wx = (screen.availWidth - width)/2;
	wy = (screen.availHeight - height)/2;


	scrollbars = 0;
	if (width + 50 > screen.availWidth || height + 50 > screen.availHeight) scrollbars = 0;
	wnd=window.open(url, "_blank", "width="+width+",height="+height+",status=no,resizable=0,scrollbars="+scrollbars+",toolbar=no,menubar=no,left="+wx+",top="+wy);
}


function arr_ch(el, state)
{
	pos = el.style.backgroundPosition.split(" ");
   if (state) new_pos = pos[0] + " 0px"; else new_pos = pos[0] + " -54px";
	el.style.backgroundPosition = new_pos;
}


function open_foto(url, width, height){

	wx = (screen.availWidth - width)/2;
	wy = (screen.availHeight - height)/2;

	width +=20;
	height +=20;
	scrollbars = 0;

	//if (width + 50 > screen.availWidth || height + 50 > screen.availHeight) scrollbars = 1;
	wnd=window.open(url, "_blank", "width="+width+",height="+height+",status=no,resizable=0,scrollbars="+scrollbars+",toolbar=no,menubar=no,left="+wx+",top="+wy);
}




// -------------- shadow mechanism ---------------------



function show_form_login()
{
 obj = document.getElementById('form_login');
 if(obj.style.visibility == 'hidden')
 {
	show_shadow(obj);
 }
 else
 {
 	hide_shadow(obj);
 }

}

function move_form_login()
{
 obj = document.getElementById('form_login');
 if(obj.style.visibility != 'hidden')
 {
	show_shadow(obj);
 }
}

function getCookie(name) {
        var prefix = name + "="
        var cookieStartIndex = document.cookie.indexOf(prefix)
        if (cookieStartIndex == -1)
                return null
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
        if (cookieEndIndex == -1)
                cookieEndIndex = document.cookie.length
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

function show_video_list(id)
{
	document.getElementById('video_line').style.display = 'none';
	document.getElementById('video_thumb').style.display = 'none';
	
	document.getElementById('line_ico').src = "/img/ico_list_line.gif";
	document.getElementById('thumb_ico').src = "/img/ico_list_thumb.gif";
	
	document.getElementById(id + "_ico").src = '/img/ico_list_' + id + "_over.gif";
	
	
	document.getElementById("video_"+id).style.display = 'block';
	document.cookie = "show_video_list = video_" + id + "; path=/";
}


function show_tab(id)
{
	var id_link = id + '_link';
	
	document.getElementById('works').style.display = 'none';
	document.getElementById('video').style.display = 'none';
	document.getElementById('comments').style.display = 'none';
	document.getElementById('other_works').style.display = 'none';
	document.getElementById(id).style.display = 'block';
	
	document.getElementById('works_link').className = '';
	document.getElementById('video_link').className = '';
	document.getElementById('comments_link').className = '';
	document.getElementById('other_works_link').className = '';
	document.getElementById(id_link).className  = 'active';
}


//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll)
	return arrayPageScroll;
}



//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		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;
	if (self.innerHeight) {	// all except Explorer
		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;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}


function show_shadow(top_obj)
{
	var objOverlay = document.getElementById('overlay');

	objOverlay.onclick = function () {hide_shadow(top_obj); return false;}

	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();

	// set height of Overlay to take up whole page and show
	objOverlay.style.height = (arrayPageSize[1] + 'px');
	objOverlay.style.display = 'block';
			

	// Hide select boxes as they will 'peek' through the image in IE
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++)
		if (selects[i].id != 'univ_form_id') selects[i].style.visibility = "hidden";

	if(top_obj)
	{
		top_obj.style.visibility = 'visible';

		var divTop = arrayPageScroll[1] + ((arrayPageSize[3] - 5 - top_obj.clientHeight) / 2);
		var divLeft = ((arrayPageSize[0] - 20 - top_obj.clientWidth) / 2);

		top_obj.style.top = (divTop < 0) ? "0px" : divTop + "px";
		top_obj.style.left = (divLeft < 0) ? "0px" : divLeft + "px";
	}
	
	obj_flash = document.getElementById('flash');
 	//obj_flash.style.visibility = 'hidden' 
 	
	
	
}


function hide_shadow(top_obj)
{
	if(top_obj)
	{
	  top_obj.style.visibility = 'hidden';
	}

	objOverlay = document.getElementById('overlay');
	objOverlay.style.display = 'none';

	// make select boxes visible
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++)
		if (selects[i].id != 'univ_form_id') selects[i].style.visibility = "visible";
	
	obj_flash = document.getElementById('flash');
 	//obj_flash.style.visibility = 'visible' 
 			
}


function show_video_player(filename)
{
	document.write('<object style="z-index:11;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="530" height="334" id="transparent" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="false" />');
	document.write('<param name="movie" value="/video_player/video_player_big.swf?videofile='+filename+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="bgcolor" value="#ffffff" />');	
	document.write('<embed src="/video_player/video_player_big.swf?videofile='+filename+'" videofile="'+filename+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="530" height="334" name="transparent" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function show_small_video_player(filename)
{
	document.write('<object style="z-index:11;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="410" height="270" id="transparent" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="false" />');
	document.write('<param name="movie" value="/video_player/video_player_embed.swf?on_site=true&videofile='+filename+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="bgcolor" value="#ffffff" />');	
	document.write('<embed src="/video_player/video_player_embed.swf?on_site=true&videofile='+filename+'" videofile="'+filename+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="410" height="270" name="transparent" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function show_baner()
{
	document.write('<object style="z-index:12;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="234" height="100" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="false" />');
	document.write('<param name="movie" value="/flash/baner_glazz.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="bgcolor" value="#ffffff" />');	
	document.write('<embed src="/flash/baner_glazz.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="234" height="100" name="transparent" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function show_baner_header()
{
	document.write('<object style="z-index:11;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="550" height="90" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="false" />');
	document.write('<param name="movie" value="/flash/baner_glazz_for_header.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="bgcolor" value="#ffffff" />');	
	document.write('<embed src="/flash/baner_glazz_for_header.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="550" height="90" name="transparent" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

 