/* ART Panorama JavaScript code
 * peter assenov- aip solutions ltd' 2009
 * @version: 1.0.01 - 2009-07-03
 */

/* ie6 background flicker work-around */
if (dl.is.ie6){  dl.load.push("document.execCommand('BackgroundImageCache', false, true)"); }
/* email rewriting */
function eml(cls,a,b,c){document.write('<a href="mailto:'+a+'@'+b+'.'+c+'" class="'+cls+'">'+a+'@'+b+'.'+c+'</a>');}
/* telephone rewriting */
function tel(className,country,code,number){document.write('<span class="'+className+'">'+country+' '+code+' '+number+'</span>');}






/* colors functionality */
dl.color=function(id)
{ 	
	this.id=id;
	window["color_"+this.id]=this;
	this.el=dl.el(this.id,this);
	this.picBig=(dl.is.el(this.id+'_picBig'))?dl.el(this.id+'_picBig',this):null;
	this.pic=(dl.is.el(this.id+'_pic'))?dl.el(this.id+'_pic',this):null;
/* get default color */
	if(dl.is.el(this.id+'_chgColors')){
		this.imgs=dl.el(this.id+'_chgColors').getElementsByTagName("A");
		for (var i=this.imgs.length-1;i>=0;i--){
			if(this.imgs[i].className.search('active')!=-1) this.active=this.imgs[i];
		}
	}
/* Big pic */
	if (this.picBig){/* inspect BigPic */
		dl.el(this.id+'_pic').ob=new fade(this.id+'_pic');
		dl.el(this.id+'_picBig').ob=new fade(this.id+'_picBig');
		//trace(this.picBig.getAttribute('imageH'))
		this.el.onmouseover=function()
		{	//trace('over');
			dl.el(this.id+'_pic').ob.go(-2);
			dl.el(this.id+'_picBig').ob.go(2);
			dl.el(this.id+'_picBig').style.width = this.offsetWidth-2+'px';
			dl.el(this.id+'_picBig').style.height = this.offsetHeight-2+'px';
		}
		this.el.onmouseout=function()
		{	//trace('out');
			dl.el(this.id+'_picBig').ob.go(-2);
			dl.el(this.id+'_pic').ob.go(2);
		}
		this.picBig.onmousemove=function(e)
		{	//trace('move');
			if (!e) var e = window.event;
			var pos_x = (e.offsetX)?e.offsetX:e.layerX;
		    var pos_y = (e.offsetX)?e.offsetY:e.layerY;
			var currImgW = parseInt(this.getAttribute('imageW'));
			var currImgH = parseInt(this.getAttribute('imageH'));
			var	moveX = parseInt(pos_x-pos_x/this.offsetWidth*currImgW);
			var	moveY = parseInt(pos_y-pos_y/this.offsetHeight*currImgH);
			this.style.backgroundPosition=moveX+'px '+moveY+'px';
		}
	} 
}
_color=dl.color.prototype;
/* public methods */
_color.change=function(e){//change active image
	if (!e) var e = window.event;
	var tmp=(e.target)?e.target:e.srcElement;
	if (this.active!=tmp){
		this.active.className='prdPic';
		this.active=tmp;
		this.active.className='prdPic active';
		this.pic.style.backgroundImage="url("+this.active.getAttribute('image')+")";
		if (dl.is.el('orderFrm'))
			dl.el('orderFrm').action = dl.el('orderFrm').action.replace(/color-\d+(=?\/)/,'color-'+this.active.getAttribute('colorId')+'/');
		if(this.picBig) {
			dl.el(this.id+'_selectedColor').value=this.active.getAttribute('colorId');
			dl.el(this.id+'_currColor').innerHTML='"'+this.active.title+'"';
			this.picBig.href=this.active.getAttribute('image').replace(/STD./,".");
			this.picBig.title=this.picBig.title.replace(/\".+[\"]/,'"'+this.active.title+'"');
			this.picBig.style.backgroundImage='url('+this.active.getAttribute('image').replace(/STD./,".")+')';
		//trace(this.picBig.style)
			this.picBig.setAttribute("imageW",this.active.getAttribute('imageW'));
			this.picBig.setAttribute("imageH",this.active.getAttribute('imageH'));
		}
	}
}
dl.load.push("dl.make('DIV');dl.make('A');");
dl.load.push("dl.process()");
/* open/close element */
function open(id)
{	dl.el(id).on();
	if(dl.is.el('over')) {
		dl.el('over').on();
		dl.el('over').style.height=dl.d.getElementsByTagName('html')[0].scrollHeight;
	}
}
function close(id)
{	dl.el(id).off();
	if(dl.is.el('over')) dl.el('over').off();
}
/* faq menu functionality */
faq={}
faq.open=function(id)
{	
	if(dl.el(id).style.display == 'block') {
		dl.el(id).off();
		dl.el(id.replace(/answer/,"faq")).className='quest';
	} else {
		dl.el(id).on();
		dl.el(id.replace(/answer/,"faq")).className='quest active';
	}
}
// end of code. enjoy...
