/*-- onload execution --*/
  if (dl.is.ie6){  dl.load.push("document.execCommand('BackgroundImageCache', false, true)"); }
/*-- site functions --*/
/* 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>')}
/* library functions */
add=function(tag,cls,par)
{	//var el=(tag=='IFRAME'&&!ns6)? document.createElement('<IFRAME FRAMEBORDER=0 allowTransparency="true"></IFRAME>') : document.createElement(tag);
	var el=document.createElement(tag);
	if(cls)	el.id=el.className=cls;
	if(par) par.appendChild(el)
return el;
}
/* open/close element */
function show(id)
{	var body=document.getElementsByTagName('body').item(0);
	var html=dl.d.getElementsByTagName('html').item(0);
	var selArr=document.getElementsByTagName('select');
	dl.el(id).on();
	dl.el(id).style.marginLeft=-parseInt(dl.el(id).offsetWidth/2)+parseInt(html.scrollLeft)+'px';
	dl.el(id).style.marginTop=-parseInt(dl.el(id).offsetHeight/2)+parseInt(html.scrollTop)+'px';
	if(selArr)
		for(var i=selArr.length-1;i>=0;i--)	selArr[i].style.visibility="hidden";
	if(!dl.is.el('over')) add('DIV','over',body);
	dl.el('over').on();
	dl.el('over').onclick=function(){hide(id)};
	dl.el('over').style.height=html.scrollHeight+'px';
}
function hide(id)
{	if (!dl.is.el(id)) return;
	dl.el(id).off();
	if(dl.is.el('over')) dl.el('over').off();
	var selArr=document.getElementsByTagName('select');
	if(selArr)
		for(var i=selArr.length-1;i>=0;i--)	selArr[i].style.visibility="visible";
}
/* Change font size */
font={def:'12px',curr:12}
font.change=function (num){
	fs = dl.el('changeFont').style;
	fs.fontSize = (num)?this.curr+num+'px':this.def;
	this.curr = parseInt(fs.fontSize);
}
/* mainMenu over */
dl.make('ul','class');
menu = function (id){
	this.id = id;
	this.el = dl.el(this.id);
	this.pics=this.el.getElementsByTagName('img');
	for(i=0;i<this.pics.length;i++)
	{	pic=this.pics[i];
		pic.onmouseover=function(){
			var parent = this.parentNode.parentNode;
			if(!parent.className.match("active")){
				parent.className += ' active curr';
				this.src=this.src.replace(/.jpg/,"A.jpg");
			}
		}
		pic.onmouseout=function(){
			var parent = this.parentNode.parentNode;
			parent.className = parent.className.replace(/ active curr/,"");
			if(!parent.className.match("active")){
				this.src=this.src.replace(/A.jpg/,".jpg");
			}
		}
	} 
}
//subMenu = menu;
subMenu = function (id){}
/** Scroll horizontal **/
scrl={t:0,cnt:0,step:3,end:270}//,obj:{}
scrl.on=function(objId,type,dir,end){
	//this.obj=dl.el(objId);
	this.end=end;
	if(type=='width'){
		dl.el(objId).style.width=dl.el(objId).offsetWidth+dir*this.step+'px';
	}else if(type=='height'){
		dl.el(objId).style.height=dl.el(objId).offsetHeight+dir*this.step+'px';
	}
	if (this.cnt==this.end) {
		this.cnt=0;
		scrl.off();
	} else {
		this.cnt+=this.step;
	}
}
scrl.off=function(){
	clearInterval(this.t)
}
scrl.go=function(objId,type,dir,end){
		this.t=setInterval("scrl.on('"+objId+"','"+type+"',"+dir+","+end+")", 10);
}
/* Login box */
function showHideLoginBox(){
	if(dl.el('loginInfo').offsetWidth>60) {dir=-1} else {dir=1};
	scrl.go('loginInfo','width',dir,267);
}
/* Shopping cart */
function showHideCart(){
	if(dl.el('cartInfo').offsetHeight>10) {dir=-1} else {dir=1};
	scrl.go('cartInfo','height',dir,36);
}
/* Add to cart */
addToCart = function(id){
	dl.el('prdToCartID').value=id;
	window.submit('cartFrm');
}
/* PASS field */
function typeChange(elem,type)
{	
	var oldObject = elem;
	var newObject = document.createElement('input');
	newObject.type = type;
	if(oldObject.value) newObject.value = oldObject.value;
	if(oldObject.tabIndex ) newObject.tabIndex = oldObject.tabIndex;
	if(oldObject.size) newObject.size = oldObject.size;
	if(oldObject.id) newObject.id = oldObject.id;
	if(oldObject.name) newObject.name = oldObject.name;
	if(oldObject.onclick) newObject.onclick = oldObject.onclick;
	if(oldObject.onfocus) newObject.onfocus = oldObject.onfocus;
	if(oldObject.onblur) newObject.onblur = oldObject.onblur;
	if(oldObject.onfocusin) newObject.onfocusin = oldObject.onfocusin;
	if(oldObject.onfocusout) newObject.onfocusout = oldObject.onfocusout;
	if(oldObject.className) newObject.className = oldObject.className;
	oldObject.parentNode.replaceChild(newObject,oldObject);

	if(type=='password') 
			setTimeout("document.forms."+newObject.form.id+".elements."+newObject.id+".focus()",6);
}

/* Video functionality */
function getVideo(id){
	new http('loadVideo'+dl.gmt(),'/ajaxLoadVideo.php?timestamp='+dl.gmt()+'&Id='+id).ondata=function(){ showVideo(this.req.responseText) }
}
function showVideo(responseAjax) {
	eval('var response ='+responseAjax);
	dl.el('video').style.width = parseInt(response.videoWidth) + 20 + 'px';
	dl.el('video').getElementsByTagName('em')[0].innerHTML = response.cmsDate;
	dl.el('video').getElementsByTagName('h3')[0].innerHTML = response.cmsTitle;
	dl.swf('flashVideo',{src:response.videoSrc,width:response.videoWidth,height:response.videoHeight}).write();
	show('video');
}

/* Equal email values */
function subm(frmId,errMess){
	var frm = dl.el(frmId);
	var pass = dl.el('pass');
	var passConf = dl.el('passConf');
	//if(pass.value!=''){
		if(pass.value==passConf.value) {
			passConf.className=passConf.className.replace(/(active|error)?$/,(' '));
			passConf.attr('errorr',"0");
			passConf.attr('errMess',"");
		} else {
			passConf.className=passConf.className.replace(/(active|error)?$/,(' error'));
			passConf.attr('errorr',"1");
			passConf.attr('errMess',errMess);
		}
	//}
	//if(){}
	window.submit(frmId);
}




