/* public javascript code
 * based on	dynlite dhtml dom api
 * @author:  Peter Assenov- AIP Solutions Ltd.' 2001-2007
 * @version: 2.2.1.3/2007-03-21
 * !requires: dynlite.0.9.js
 */

/* onload execution */
 if (!ns6){  load.push("document.execCommand('BackgroundImageCache', false, true);"); }

/* library functions */
evt=function(el,evt,obj){(ns6)?el.addEventListener(evt,obj,false):el.attachEvent('on'+evt,obj)}
noevt=function(el,evt,obj){(ns6)?el.removeEventListener(evt,obj,false):el.detachEvent('on'+evt,obj)}
exists=function(nam){return document.getElementById(nam)}
url=function(url){self.location.href=url;}
/* email rewriting */
function eml(cls,a,b,c){document.write('<a href="mailto:'+a+'@'+b+'.'+c+'" class="'+cls+'" onfocus="this.blur()">'+a+'@'+b+'.'+c+'</a>');}
/* telephone rewriting */
function tel(className,country,code,number){document.write('<span class="'+className+'">'+country+' ('+code+') '+number+'</span>')}
/* debug functionality */
document.onkeyup=function(e)
{	if(!e) e=event;
	if(e.altKey&&e.ctrlKey&&e.keyCode==68)	// press Ctrl-Alt-D to visualize debug info
	{	log.push('--- dynlite log end ---');
		var err=log.join('<br>');
			err=err.replace(/#([^<]+)</gi,'<b class="debug"># $1</b><'); // status messages
			err=err.replace(/\!([^<]+)</gi,'<em class="debug">! $1</em><'); // error messages
		var el=obj("debug");
			el.innerHTML=err;
			el.on();
			el.onclick=function(){this.off()}
	}
};

/* div popup class */
function divPopup(id,cont,img)
{	this.id=id;
	this._img=new Image();
	this._contName=cont;
	this._imgName=img;
	this.cont=0;
	this.img=0;
	lastImg='';
}
/* div popup methods */
/* private */
_dp=divPopup.prototype;
_dp._show=function()
{	if(this.time) 
	{	clearTimeout(this.time);
	}
	this.img.src=this._img.src;
	this.cont.style.width=this._img.width;
	this.cont.style.height=this._img.height;
	if(this.lbl)
	{	this.img.width=this._img.width;
		this.img.height=this._img.height;
	}
/* calculating Y-coord of the enlarge div */
	//default x position
	this.cont.style.left=posObjX-this._img.width+"px";
	if((this._img.width+posObjX)>document.body.scrollWidth)
		if((posObjX-this._img.width)<0)
			this.cont.style.left=0;
		else
			this.cont.style.left=posObjX-this._img.width+"px";
	else
		this.cont.style.left=posObjX+"px";
/* calculating Y-coord of the enlarge div */
	//default y position
	this.cont.style.top=posObjY-this._img.height+"px";
	if((this._img.height+posObjY)>document.body.scrollHeight)
		if((posObjY-this._img.height)<0)
			this.cont.style.top=0;
		else
			this.cont.style.top=posObjY-this._img.height+"px";
	else
		this.cont.style.top=posObjY+"px";
	(ns6)? this.cont.style.MozOpacity="1":this.cont.filters.alpha.opacity="100";
	setTimeout("obj('enlargeBottom').on()",450);
}
/* public */
function disableEvent(){return false;}
function enableEvent(){return true;}
_dp.show=function(src,e)
{	if(!this.cont) this.cont=obj(this._contName);
	if(!this.img) this.img=obj(this._imgName);
	if(!ns6) e=event;
	posObjY=e.clientY+document.body.scrollTop;
	posObjX=e.clientX+document.body.scrollLeft;
	this._img.defsrc=this.img.getAttribute("defsrc",false);
	this._img.src=src;
	this._img.onload=function(){dp._show();};
	this.time=setTimeout("dp._show()",100);
	obj('enlargeBottom').off();
	this.cont.on();
	document.onselectstart = disableEvent;
	document.onmousedown = disableEvent;
	document.ondragstart = disableEvent;
}
_dp.close=function()
{	this.cont.off();
	this.img.src=this._img.defsrc;
	(ns6)? this.cont.style.MozOpacity=".7":this.cont.filters.alpha.opacity="70";
	document.onselectstart = enableEvent;
	document.onmousedown = enableEvent;
	document.ondragstart = enableEvent;
}
_dp.drag=function(e)
{	if(!ns6) e=event;
	this.offsetY=e.clientY-this.cont.offsetTop;
	this.offsetX=e.clientX-this.cont.offsetLeft;
	evt(document,'mousemove',dp_move);
	evt(document,'mouseup',dp_stopmove);
}
function dp_move(e)
{	if(!ns6) e=event;
	dp.cont.style.top=e.clientY-dp.offsetY;	
	dp.cont.style.left=e.clientX-dp.offsetX;
//	obj('ert').value=dp.cont.style.top;
	//e.cancelBubble = true
	//dp.cont.onmouseout=function(){dp_stopmove();}
	//if(parseInt(dp.cont.style.top)<10) info(e);//setTimeout('dp_stopmove()',10);
		
}
function dp_stopmove(e)
{	noevt(document,'mousemove',dp_move);
}
_dp.resize=function(e)
{	if(!ns6) e=event;
	this.lbl=1;
	this.offsetY=e.clientY-this.img.height;
	this.offsetX=e.clientX-this.img.width;
	evt(document,'mousemove',dp_size);
	evt(document,'mouseup',dp_stopsize);
	
}
function dp_size(e)
{	if(!ns6) e=event;
	dp.cont.style.width=(e.clientX-dp.offsetX>0)? e.clientX-dp.offsetX:0;
	dp.cont.style.height=(e.clientY-dp.offsetY>0)? e.clientY-dp.offsetY:0;
	dp.img.width=(e.clientX-dp.offsetX>0)? e.clientX-dp.offsetX:0;
	dp.img.height=(e.clientY-dp.offsetY>0)? e.clientY-dp.offsetY:0;
}
function dp_stopsize(e)
{	noevt(document,'mousemove',dp_size);
}	

/* static object creation */
dp=new divPopup('dp','enlarge','enlargePic');









//pop-up Privacy Policy
function showHide(id)
{	el=obj(id)
 	if((el.style.display=="none")||(el.style.display=="")){el.on()}else{el.off()}
}
//mainMenu over effect
function overMenu(ob)
{	el=ob;
 	el.src=(el.src.search("A.gif") != -1)?el.src.replace(/A.gif/,".gif"):el.src.replace(/.gif/,"A.gif");
}
/* from tonali.it
function popupopen(file,w,h)
{ this.popupW=w||350;
 this.popupH=h||500;
 this.popupX=parseInt(((ns6)? window.innerWidth:document.body.offsetWidth)/2-this.popupW/2)||100;
 this.popupY=parseInt(((ns6)? window.innerHeight:document.body.offsetHeight)/2-this.popupH/2)||50;
 if(this.popupWin)
 { this.popupWin.close();
 this.popupWin=0;
 }
 this.popupWin=window.open(file,'popupWindow','left='+this.popupX+',top='+this.popupY+',width='+this.popupW+',height='+this.popupH+',scrollbars=1,resizable=1');
 this.popupWin.focus();
};
*/
var oldDiv='';
function showTabs(divId)
{ if(oldDiv)
	{var tab=document.getElementById('tab'+oldDiv);
	 var tabCont=document.getElementById('tab'+oldDiv+'Cont');
	 tab.className="";
	 tabCont.style.display="none";
	 }
 oldDiv=divId;
 var tab=document.getElementById('tab'+oldDiv);
 var tabCont=document.getElementById('tab'+oldDiv+'Cont');
 tab.className="active";
 tabCont.style.display="block";
}


