var max_menu=1000;

var menu_array=new Array();
for (i=0; i<=max_menu; i++){
        menu_array[i]=0;
}

var select_method; //DOM type
var nn=false;
var domb=false;
var msie=false;

function set_browser(){
        if (document.getElementById){
                select_method="getElementById";
                domb=!domb;

        }
        else if (document.all){
                select_method="all";
                msie=!msie

        }
        else if (document.layers){
                nn=!nn;
        }
        else {
                alert("Browser is not defined!");
        }
}

set_browser();

function set_visible_ie(div_id){
        eval("document."+select_method+"('id"+div_id+"').style.visibility='visible'");
        eval("document."+select_method+"('id"+div_id+"').style.position='relative'");
        eval("document."+select_method+"('id"+div_id+"').style.top='0px'");
        eval("document.arrow_"+div_id+".src='imgs/menu-arrow-down.gif'");
}

function set_hide_ie(div_id){
        eval("document."+select_method+"('id"+div_id+"').style.visibility='hidden'");
        eval("document."+select_method+"('id"+div_id+"').style.position='absolute'");
        eval("document."+select_method+"('id"+div_id+"').style.top='-2000px'");
        eval("document.arrow_"+div_id+".src='imgs/menu-arrow-left.gif'");
}

function set_change(div_id){
        if ((domb)||(msie)){
                if (menu_array[div_id]==0){
                        set_visible_ie(div_id);
                        menu_array[div_id]=1;
                }
                else {
                        set_hide_ie(div_id);
                        menu_array[div_id]=0;
                }
        }
}

function show_block(div_id){
        if (!nn){
                eval("document."+select_method+"('"+div_id+"').style.visibility='visible'");
                eval("document."+select_method+"('"+div_id+"').style.position='relative'");
                eval("document."+select_method+"('"+div_id+"').style.top='0px'");
                }
        }

// POPUP FUNCTIONS

var scr_height=800;
var scr_width=600;
var win_height;
var win_width;

if (screen.availHeight){
var scr_height=screen.availHeight;
var scr_width=screen.availWidth;
}

// PARAMS FOR POPUP

        win_height=560;
        win_width=620;
        win_top=scr_height/2-win_height/2;
        win_left=scr_width/2-win_width/2;
        win_dimensions="height="+win_height+",width="+win_width+", top="+win_top+", left="+win_left+", status, scrollbars, resizable";
        win_dimensions2="status, scrollbars, resizable";
        win_tshirt="width=689,height=560,scrollbars=yes,resizable=no";

function show_basket()
{
        basketball = window.open("http://www.artmam.com/payment/basket/basket.php","basketball",win_dimensions);
        if (basketball){basketball.focus();}
}


function return_to_basket()
{
        basketball = window.open("http://www.artmam.com/payment/basket/basket.php","basketball",win_dimensions);
        if (basketball){basketball.focus();}
}

function show_service(s,name,p1,p2,p3,p4)
{
    if (s=="offer_price"){
                offer = window.open("http://artmam.com/addon/offer_price.php","offer",win_dimensions);
                if (offer){offer.focus();}
        }
        if (s=="ask_about"){
            params = "?good_url=http://"+name+"&dom="+p1;
                about = window.open("http://artmam.com/addon/ask_about.php"+params,"about",win_dimensions);
                if (about){about.focus();}
        }
        if (s=="send_to_friend"){
            params = "?server=http://"+name+"/&good_id="+p1+"&good_title="+p2+"&good_img="+p3+"&dom="+p4;
                friend = window.open("http://artmam.com/addon/send_to_friend.php"+params,"friend",win_dimensions);
                if (friend){friend.focus();}
        }
        if (s=="buy_original" || s=="buy"){
                basketball = window.open("","basketball",win_dimensions);
                document.basform.submit();
                if (basketball){basketball.focus();}
        }
        if (s=="buy_poster"){
            params = "?dom="+name+"&image="+p1;
                posters = window.open("http://artmam.com/addon/posters.php"+params,"posters",win_dimensions2);
                if (posters){posters.focus();}
        }
        if (s=="buy_print"){
            params = "?dom="+name+"&image="+p1+"&pid="+p2+"&good_id="+p3;
                prints = window.open("http://artmam.com/addon/print.php"+params,"prints",win_dimensions2);
                if (prints){prints.focus();}
        }
        if (s=="t_shirt"){
            params = "?dom="+name+"&image="+p1;
                tshirt = window.open("http://t-shirt.artmam.com/"+params,"tshirt",win_tshirt);
                if (tshirt){tshirt.focus();}
        }
        if (s=="mobile"){
                Photoperso = window.open("http://www.sonnerie.net/photoperso/index02.php?la=EN&a=napoleon&url=http://artmam.com/all/shop/Good/"+name,"Photoperso",'width=640 height=600 scrollbar=no toolbar=no');
                if (Photoperso){Photoperso.focus();}
        }
        if (s=="posters"){
                buy_posters = window.open("http://artmam.com/posters/index.php","buy_posters","height=749,width=590,scrollbars=yes");
                if (buy_posters){buy_posters.focus();}
        }
        if (s=="policy"){
                 policy = window.open("http://artmam.com/payment/basket/other/policy.html","policy","height=330,width=610,scrollbars=yes");
                if (policy){policy.focus();}
        }
}

// CHECK FUNCTIONS

function test_field()
{
        if (document.op_form.email.value=="") {alert ("Enter your e-mail so that we may contact you.")}
        else { document.op_form.submit(); }
}

function test_feedback()
{
        if ((document.fb_form.name.value=="") || (document.fb_form.mess.value=="")) {alert ("Enter your name and message, please.")}
        else { document.fb_form.submit(); }
}

//Old functions. created by Vova. added by Kull

var i=11;
var flag=true;
var flag2=true;
function set_bg(c){
    switch(c){
      case 10:
        c="a"
        break
      case 11:
        c="b"
        break
      case 12:
        c="c"
        break
      case 13:
        c="d"
        break
      case 14:
        c="e"
        break
      case 15:
        c="f"
        break
    }

  if (document.getElementById){
    document.getElementById("email").style.backgroundColor="#"+c+"c"+c;
  }
}
function bg_anim(){
  if (flag){
    i++;
    if (i==14) flag=!flag;
  }
  if (!flag){
    i--;
    if (i==11) flag=!flag;
  }
  set_bg(i);
  if (flag2){
    var timeout_id=setTimeout("bg_anim()",300);
  }
  else {
    if (document.getElementById){
      document.getElementById("email").style.backgroundColor="#fff";
      if (document.getElementById("email").value=="Your e-mail"){
        document.getElementById("email").value="";
      }
    }
  }
}

function stop_splash(){
  flag2=!flag2;
}

function start_splash(){
  flag2=!flag2;
  bg_anim();

}

