var op_menu='';
var op_arr='';
var go_on=false;
var open_width=250;
var open_height=150;

function showemail() {
a="mekler";b="natasha";c="@";
window.location="mailto:info"+c+b+a+'.ru';
}

function show_hide(v){
d=document.getElementById(v);
if (d==null) return;
if(d.style.display=='block') d.style.display='none'; else d.style.display='block';
}

function GoBox(v){
TO=Array("boss","web","media","photo","pr","support");
Z=Array(0,0,0,0,1,0);
D=Array("-","");
PT=Array(".com",".ru");
if (v=='admin') {idx=0;x=Z[idx];}
if (v=='web') {idx=1;x=Z[idx];}
if (v=='media') {idx=2;x=Z[idx];}
if (v=='photo') {idx=3;x=Z[idx];}
if (v=='pr') {idx=4;x=Z[idx];}
if (v=='support') {idx=5;x=Z[idx];}
line=TO[idx]+'@vio'+D[x]+'media'+PT[x];	
window.location="mailto:"+line;
}
function show_works(v) {
	l = Math.round(screen.width/2 - 10);
	t = Math.round(screen.height/2 - 10);
	wn=window.open("/works/"+v+"/", 'works_'+v,'width=10,left='+l+', top='+t+', height=20, resizable=no, scrollbars=no');
	wn.focus();
}

function MakeBlur()	{
var a = document.getElementsByTagName('a'), i = a.length;	
while (i--) {	
    a[i].hideFocus = true;	
} 

}

function openMenu(v,h,w){
if (go_on) return;
if (op_menu!='') {closeMenu(); return;}
if (document.getElementById(v)==null) return;
go_on=true;
closeArrow();
op_menu=v;
open_width=w;
open_height=h;
document.getElementById(op_menu).style.zIndex=10;
closeHeight=8;
closeWidth=8;
open_hz(v);
}

function openRMenu(v,h,w){
if (go_on) return;
if (op_menu!='') {closeMenu(); return;}
if (document.getElementById(v)==null) return;
go_on=true;
op_menu=v;
open_width=w;
open_height=h;
closeHeight=15;
closeWidth=23;
document.getElementById(op_menu).style.zIndex=10;
setright=document.getElementById(op_menu).style.right;
		wd=document.getElementById(v).style.width;
		delta=wd.substr(0,wd.indexOf('px'));
		width=Math.round(delta);
		tick_hz=window.setInterval(function() 
			{
				width=width+20;
				document.getElementById(v).style.width=width+"px";
				document.getElementById(v).style.right=setright;
				if (width>=open_width) {
					window.clearTimeout(tick_hz);
					document.getElementById(v).style.width=open_width+"px";
					document.getElementById(v).style.right=setright;
					open_vt(v);
				}
			}, 2);

}
function CancelClick(evt) {
     evt = (evt) ? evt : ((window.event) ? event : null );	
     elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);		
      evt.cancelBubble = true;	
      evt.returnValue = false;	
	return false;
}

function closeMenu(){
if (go_on) return;
if (document.getElementById(op_menu)==null) return;
go_on=true;
alert('FFFF');
alert(event.type);
close_vt(op_menu);
op_menu="";
}


function DL_GetElementLeft(eElement) {	
    var nLeftPos = eElement.offsetLeft;          // initialize var to store calculations	
    var eParElement = eElement.offsetParent;     // identify first offset parent element  	
    while (eParElement != null) {                                            // move up through element hierarchy	
        nLeftPos += eParElement.offsetLeft;      // appending left offset of each parent	
        eParElement = eParElement.offsetParent;  // until no more offset parents exist	
    }	
    return nLeftPos;                             // return the number calculated	
}	
function DL_GetElementTop(eElement) {	
    var nTopPos = eElement.offsetTop;            // initialize var to store calculations	
    var eParElement = eElement.offsetParent;     // identify first offset parent element  	
    while (eParElement != null) {                                            // move up through element hierarchy	
        nTopPos += eParElement.offsetTop;        // appending top offset of each parent	
        eParElement = eParElement.offsetParent;  // until no more offset parents exist	
    }	
    return nTopPos;                              // return the number calculated	
}

function closeMenu(){
if (go_on) return;
if (document.getElementById(op_menu)==null) return;
go_on=true;
close_vt(op_menu);
op_menu="";
}


function openArrow(v){
if (go_on) return;
if (v==op_arr) { return;}
if (document.getElementById(v)==null) return;
closeArrow();
op_arr=v;	
open_arrow(v);
}

function closeArrow(){
if (op_arr!='') {
	document.getElementById(op_arr).style.width='8px'; 
	window.clearTimeout(tick_arrow);
	op_arr='';
	}
}

//
//
//
//
//


function close_hz(va) {
wd=document.getElementById(va).style.width;
delta=wd.substr(0,wd.indexOf('px'));
width=Math.round(delta);

var tick_hzC=window.setInterval(function() 
			{
				width=width-20;
				if (width<=0) width=closeWidth;
				document.getElementById(va).style.width=width+"px";
				if(width<=closeWidth) {
					window.clearTimeout(tick_hzC);
					document.getElementById(va).style.width=closeWidth+"px";
					document.getElementById(va).style.zIndex=0;
					go_on=false;
					op_menu="";
				}
			}, 2);
}

function close_vt(va) {
wd=document.getElementById(va).style.height;
delta=wd.substr(0,wd.indexOf('px'));
height=Math.round(delta);

var tick_vtC=window.setInterval(function() 
			{
				height=height-20;
				if (height<=0) height=closeHeight;
				document.getElementById(va).style.height=height+"px";
				if(height<=closeHeight) {
					window.clearTimeout(tick_vtC);
					document.getElementById(va).style.height=closeHeight+"px";
					close_hz(va);
				}
			}, 2);
}


function open_arrow(va) {
width=8;
tick_arrow=window.setInterval(function() 
			{
				width=width+1;
				document.getElementById(va).style.width=width+"px";
				if (width>=open_width) {
					width=8;					
				}
			}, 2);
}


function open_hz(va) {
		wd=document.getElementById(va).style.width;
		delta=wd.substr(0,wd.indexOf('px'));
		width=Math.round(delta);
		tick_hz=window.setInterval(function() 
			{
				width=width+20;
				document.getElementById(va).style.width=width+"px";
				if (width>=open_width) {
					window.clearTimeout(tick_hz);
					document.getElementById(va).style.width=open_width+"px";
					open_vt(va);
				}
			}, 2);
}

function open_vt(va) {
wd=document.getElementById(va).style.height;
delta=wd.substr(0,wd.indexOf('px'));
height=Math.round(delta);

var tick_vt=window.setInterval(function() 
			{
				height=height+20;
				document.getElementById(va).style.height=height+"px";
				if(height>=open_height) {
					window.clearTimeout(tick_vt);
					document.getElementById(va).style.height=open_height+"px";
					go_on=false;
				}
			}, 2);
}
