function OpenCal(cal_id) {
      /*
        $("#dialog").dialog("destroy");
        $("#dialog").dialog({ modal: true, bgiframe: true });
      */
    $.post("open_cal.php",{ cid: cal_id},
            function(data){
                $("#dialog").dialog("destroy");
                $("#dialog").dialog({ modal: true, bgiframe: true, width:500,
                    title: 'Evenemang'});
                $('#dialog').html(data);
            }, "html");
    
      return false;      
}

function OpenCalAdmin(cal_id) {
      /*
        $("#dialog").dialog("destroy");
        $("#dialog").dialog({ modal: true, bgiframe: true });
      */
    
    $.post("open_cal_admin.php",{ cid: cal_id},
            function(data){
                $("#dialog_cal").dialog("destroy");
                $("#dialog_cal").dialog({ modal: true, bgiframe: true, width:500,
                    title: 'Evenemang'});
                $('#dialog_cal').html(data);
            }, "html");
    
      return false;      
}

function sendValue(str) {
    $.post("search_all.php",{ search_all: str, type: 'link' },
            function(data){
                if (str == '') {
                    $('#search_all_results').css({"display":"none"});   
                }
                else {
                    $('#search_all_results').css({"display":"block"});   
                    $('#results_link').html(data);
                }
            }, "html");
            
        $.post("search_all.php",{ search_all: str, type: 'rss' },
            function(data){
                if (str == '') {
                    $('#search_all_results').css({"display":"none"});   
                }
                else {
                    $('#search_all_results').css({"display":"block"});   
                    $('#results_rss').html(data);
                }
            }, "html");
            
         $.post("search_all.php",{ search_all: str, type: 'svk' },
            function(data){
                if (str == '') {
                    $('#search_all_results').css({"display":"none"});   
                }
                else {
                    $('#search_all_results').css({"display":"block"});   
                    $('#results_svk').html(data);
                }
            }, "html");
         
         $.post("search_all.php",{ search_all: str, type: 'amanda' },
            function(data){
                if (str == '') {
                    $('#search_all_results').css({"display":"none"});   
                }
                else {
                    $('#search_all_results').css({"display":"block"});   
                    $('#results_amanda').html(data);
                }
            }, "html");
         
         $.post("search_all.php",{ search_all: str, type: 'kkv' },
            function(data){
                if (str == '') {
                    $('#search_all_results').css({"display":"none"});   
                }
                else {
                    $('#search_all_results').css({"display":"block"});   
                    $('#results_kkv').html(data);
                }
            }, "html");
    //alert('2');

}


function show_bill(bid, print){
   add ="";
   if(print==1){
     add = "action=print&";
   }
   window.open("show_bill.php?"+add+"bid=" + bid, "bill_"+bid, 'width=450,height=340,location=no,toolbar=no,scrollbars=no');
}

function disableEnterKey(e) {
     var key;     
     if(window.event)
          key = window.event.keyCode; //IE
     else
          key = e.which; //firefox     

     return (key != 13);
}


function displayhtml600x600(filename)
{
   window.open(filename, '', 'width=600,height=600,location=no,toolbar=no,scrollbars=yes');
}

function openRadion(filename, name)
{
   window.open(filename, name, 'width=345,height=480,location=no,toolbar=no,scrollbars=no');
}


function checkArtistLink(){
  // window.open("show_vcard.php?calid=" + calid, "vcard", 'width=640,height=460,location=no,toolbar=no,scrollbars=no');
  artist_name = document.theform.artist_name.value;
  artist_lastname = document.theform.artist_lastname.value;
  
  window.open("checklink.php?name=" + artist_name + "&last="+artist_lastname, "link", 'width=640,height=460,location=no,toolbar=no,scrollbars=no');
}

function chooseArtist(gal){
  window.opener.document.theform.artist_link2.value="http://www.svenskakonstnarer.se/start/opengal.php?aid=" + gal;
  window.close();
}


function cleanSvk(){
  window.document.theform.artist_link2.value="";
}


function suredelete(chr, aid){
  if (confirm("Är du säker på att du vill radera denna posten?")) {
    window.location="deleteartist.php?id="+aid+"&char="+chr;
  }
}


function checkLexikon(theForm){
 if( theForm.artist_name.value=="" ||  theForm.artist_lastname.value=="" || theForm.artist_bio.value=="" ){
   alert("Fyll i alla obligatoriska fält");
   return(false);
 }

 return(true);
}

function surewithtext(page, text){
  if (confirm(text)) {
    window.location=page;  
  }
}

function openpop(url){
   window.open (url,"adminadd","width=750,height=600,toolbars=yes,scrollbars=yes");
}



function openpicaktuellt(name, w, h, i ){
   page = "../start/openpicaktuellt.php?pic=" + name ;
   window.open (page, i,"width="+w+",height="+h+",toolbars=no,scrollbars=no");
}

function openinfo(id){
   url = "openinfo.php?mgalid="+id;
   window.open (url,"info","width=350,height=450,toolbars=yes,scrollbars=yes");
}

function opencal(url){
   window.open (url,"adminadd","width=850,height=630,toolbars=yes,scrollbars=yes");
}


function openlink(url){
   window.open (url,"Anmala","width=780,height=600,toolbars=yes,scrollbars=yes");
}




function opengallery(url){
   window.open (url,"gallery","width=700,height=500,toolbars=yes,scrollbars=yes");
}

function surewithtext(page,txt){
if (confirm(txt))
  window.location = page;
}

function sure(page){
if (confirm("Vill du radera posten? OBS: Går ej att ångra."))
  window.location = page;
}

