function setMask(I,M){	
    function R(s){return new RegExp('('+s.replace(/\(/g,'\\(').replace(/\)/g,'\\)').replace(/\//g,'\\/').replace(/9/g,'\\d').replace(/a/g,'[a-zā-˙¸]').replace(/\*/g,'[a-zā-˙¸0-9]')+')','gi')}	
    function N(c,j,x){	
        for(var k=0,s='';k<L;k++)s+=$[k]||c||'_';	
        I.value=s;	
        x?0:I.sC(!j?i:0)	
    }	
    function D(e,p,i){	
        p=I.gC();	
        if (p[0]==p[1]) {	
            if(e)p[1]++;	
            else p[0]--	
        }	
        for(i=p[0];i<p[1];i++)	
            if(!S[i]&&$[i]){	
                $[i]=0;	
                j--	
            }	
        return p	
    }	
    function V(){	
        setTimeout(function(k){	
                if (R(M).test(I.value)) {	
                    I.value=RegExp.$1;	
                    $=I.value.split('');	
                    for(k=j=0;k<L;k++)if(!S[k])j++	
                }	
                else N()	
            },0)	
    }	
    function P(c){	
        if (c<35&&c!=8||c==45) return 1;	
        switch(c){	
            case 8:     i=D()[0]; return 0;	
            case 46:    i=D(1)[1]; return 0;	
            case 35:    i = L; return 1;	
            case 36:    i = 1;	
            case 37:    if (i-=2<-1) i=-1;	
            case 39:    if (++i>L) i=L; return 1;	
            default:    i=I.gC()[0];	
                        while(i<L&&S[i]){i++}	
                        if (i==L) return 0;	
                         	
                        c = String.fromCharCode(c)	
                        if (R(M.charAt(i)).test(c)) {	
                            D(1);	
                            $[i++] = c;	
                            j++;	
                            while(i<L&&S[i]){i++}	
                        }	
                        return 0	
        }	
    }	
     	
    var d=document, c='character', y=-100000, L=M.length, G=!c, i=0, j=0, $=M.split(''), S=M.split('');	
     	
    for (var k=0;k<L;k++) if (/a|9|\*/.test($[k])) $[k]=S[k]=0;	
    I = typeof I=='string' ? d.getElementById(I) : I;	
     	
    I.sC = function(l,g){	
        if(this.setSelectionRange) this.setSelectionRange(l,l);	
        else {	
            g = this.createTextRange();	
            g.collapse(true);	
            g.moveStart(c,y);	
            g.move(c,l);	
            g.select();	
        }	
    }	
    I.gC = function(r,b){	
        if (this.setSelectionRange) return [this.selectionStart,this.selectionEnd];	
        else {	
            r = d['selection'].createRange();	
            b = 0-r.duplicate().moveStart(c,y)	
            return [b,b+r.text.length]	
        }	
    }	
    I.onfocus = function(){	
        setTimeout(function(){N(0,!j)},0)	
    }	
    I.onblur = function(){	
        j ? N(' ',0,1) : this.value=''	
    }	
    I.onkeydown = function(e,c){	
        e = e||event;	
        c = e.keyCode||e.charCode;	
         	
        if (c==8||c==46) {	
            G = true;	
            P(c);	
            N();	
            return !G	
        }	
        else if (!window.netscape&&(c>34&&c<38||c==39)) P(c)	
    }	
    I.onkeypress = function(e){	
        if (G) return G=!G;	
         	
        e = e||event;	
         	
        if (P(e.keyCode||e.charCode)) return !G;	
         	
        N();	
         	
        return G	
    }	
     	
    if (d.all&&!window.opera) I.onpaste=V;	
    else I.addEventListener('input',V,false)	
}



isOpera = 0;
isOpera6 = 0;
isOpera7 = 0;
isOpera8 = 0;
isOpera9 = 0;
isNetscape4 = 0;
isMozilla = 0;
isDOM=(document.getElementById)?1:0;//DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
isOpera=isOpera5=(window.opera && isDOM)?1:0;//Opera 5+
isOpera6=(isOpera && window.print)?1:0; //Opera 6+
isOpera7=(isOpera && document.readyState)?1:0 ;//Opera 7+
isMSIE=(document.all && document.all.item && !isOpera)?1:0; //Microsoft Internet Explorer 4+
isMSIE5=(isDOM && isMSIE)?1:0; //MSIE 5+
isNetscape4=(document.layers)?1:0; //Netscape 4.*
isMozilla=(isDOM && navigator.appName=="Netscape")?1:0; //Mozilla eee Netscape 6.*

var nn=0;
var oo=0;
var mn_h=0;
if(navigator.appName=="Netscape"){nn=1}
nav=navigator.userAgent;k=nav.indexOf("O");// Opera
if(k>1){oo=1}
var mn=document.getElementById("mn_60");
var mn_cur="";
var mn_width=166;
var t1="";//interval;
var t2="";//interval;
function mnSHOW(n){
        clearInterval(t2);
        //if(n!=2&&mn_cur!=n){
        if(mn_cur!=n){
                w=document.body.clientWidth;
                mn_h=0;mn_cur=n;
                mn.style.display="none";
                clearInterval(t1);
                mn=document.getElementById("mn_"+n);
                if(navigator.appName=="Netscape" || isOpera || isOpera6 || isOpera7 || isOpera8 || isOpera9){
                        obj=document.getElementById("nn_"+n);
                        x=document.body.offsetLeft+obj.offsetLeft+obj.offsetParent.offsetLeft+obj.offsetParent.offsetParent.offsetLeft+obj.offsetParent.offsetParent.offsetParent.offsetLeft;
                       	//x=obj.name;
                        //alert(x);
		    }else{
                        x=event.x-event.offsetX;
                }
				if(typeof window.pageXOffset!='undefined'&&!oo){
				//Firefox
				}else{
				x+=document.body.scrollLeft;
				}
                if(x+mn_width>w){s=x+mn_width-w}else{s=15}
                mn.style.left=x-s+document.body.scrollLeft;
                mn.style.top=232;
                document.getElementById("tmn_"+n).style.top="-100px";
                mn.style.display="block";
                t1=setInterval("setH()",10);
}        }

function setH(){
        if(mn_h<100){
                mn_h+=4;
                document.getElementById("tmn_"+mn_cur).style.top=(-100+mn_h);
        }else{
                clearInterval(t1);
        }
}

function mnHIDE(){
        mn.style.display="none";
        mn_cur="";
}
function mnHIDE_2(){
        t2=setTimeout("mnHIDE()",100);
}
function bgON(obj){
        obj.style.backgroundColor="#007CAB";
        obj.style.color="#ffffff";
}

function bgOFF(obj){
        obj.style.backgroundColor="";
        obj.style.color="#1561A1";
}

function StartFlash(obj){
	if(window.sidebar){
	}
	else if(window.opera && window.print){
		document.getElementById('opera').innerHTML='<img src="/templates/artis/images/x.gif"  width="100%" height="119" alt="">';

	}
	else 
        {
	} 
}
function show(){
	
		var layer = document.getElementById("layerShadow");
		var win	  = document.getElementById("questionLayer");
		var img	  = document.images["bg"];
		
		var h_pos = document.body.clientWidth/2 - 182;
		var v_pos = document.body.scrollTop + 60; // document.body.clientHeight/2 - win.height/2;

		win.style.left = h_pos;
		win.style.top  = v_pos;
		
		layer.style.width  = document.body.clientWidth;
		layer.style.height = 1000;		
		
		img.width  = document.body.clientWidth;
		img.height = 2900;
		
		enableAlphaImages();
		
		win.style.display   = "block";
		layer.style.display = "block";
}
function show_send(){
	
		var layer = document.getElementById("layerShadow");
		var win	  = document.getElementById("sendLayer");
		var img	  = document.images["bg"];
		
		var h_pos = document.body.clientWidth/2 - 182;
		var v_pos = document.body.scrollTop + 260; // document.body.clientHeight/2 - win.height/2;

		win.style.left = h_pos;
		win.style.top  = v_pos;
		
		layer.style.width  = document.body.clientWidth;
		layer.style.height = 1000;		
		
		img.width  = document.body.clientWidth;
		img.height = 2900;
		
		enableAlphaImages();
		
		win.style.display   = "block";
		layer.style.display = "block";		
		
  	    setTimeout("hide_send();",5000);
		
}
function hide(){
	
		var layer = document.getElementById("layerShadow");
		var win	  = document.getElementById("questionLayer");
		
		win.style.left = 0;
		win.style.top  = 0;
		
		img.width  = 0;
		img.height = 0;
		
		win.style.display	= "none";
		layer.style.display = "none";
}
function hide_send(){
	
		var layer = document.getElementById("layerShadow");
		var win	  = document.getElementById("sendLayer");
		
		win.style.left = 0;
		win.style.top  = 0;	
		
		win.style.display	= "none";
		layer.style.display = "none";
}
function enableAlphaImages(){
		var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
		var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	
		var img = document.images["bg"];
	
		isDOM = document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
		isOpera = isOpera5 = window.opera && isDOM //Opera 5+
		isMSIE = document.all && document.all.item && !isOpera //Microsoft Internet Explorer 4+
		isMSIE5 = isDOM && isMSIE //MSIE 5+
	
		if (isMSIE5)
		{
			img.src = "/templates/summer/images/bg.png";
			document.getElementById("layerShadow").filters.Alpha.opacity = 30;
		}
}
function applyBannerZone(str) {
		for (var i = 0; i < document.forms.length; ++i) {
			if (document.forms[i].posted != null) {
				document.forms[i].posted.value = str;
			}
		}
}
function presubmit(f){
	     reg=/[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9\-\.]+\.[a-zA-Z]+/;
		 result = reg.test(f.email.value);
		 
	 	 if (f.username.value == ''){
		    f.username.focus();
			return false;
		 }
		 if (!result){ 
		    f.email.focus(); 
		    return false; 
		 }
		 if (f.phone.value == '') {
		     f.phone.focus(); 
			 return false;
		 }
		 if (f.textbody.value == '') {
		    f.textbody.focus(); 
			return false;
		 }
		 hide();
		 
		 return true;
}

