﻿
var reEmail = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
var reTel = /^[\d\s]{10,25}|[+][\d\s]{10,25}$/;
var reNumber = /[0-9]/;
var reYear = /^[0-9]{2,4}$/;

// ------------------------------------- REGEX DATE ------------------------------------------------------//
function CheckDate(datum)
{
    //(Schritt 1) Fehlerbehandlung
    if (!datum) return false;
    datum=datum.toString();

    //(Schritt 2) Aufspaltung des Datums
    datum=datum.split(".");
    if (datum.length!=3) return false;
    
    if(!datum[0].match(reNumber)) return false;
    if(!datum[1].match(reNumber)) return false;
    if(!datum[2].match(reNumber)) return false;
    
    //(Schritt 3) Entfernung der fuehrenden Nullen und Anpassung des Monats
    datum[0]=parseInt(datum[0],10);
    datum[1]=parseInt(datum[1],10)-1;

    //(Schritt 4) Behandlung Jahr nur zweistellig
    if (datum[2].length==2) datum[2]="20"+datum[2];
    
    // wenn länger als 4
    if(datum[2].length > 4) return false;

    //(Schritt 5) Erzeugung eines neuen Dateobjektes
    var kontrolldatum=new Date(datum[2],datum[1],datum[0]);

    //(Schritt 6) Vergleich, ob das eingegebene Datum gleich dem JS-Datum ist
    if (kontrolldatum.getDate()==datum[0] && kontrolldatum.getMonth()==datum[1] && kontrolldatum.getFullYear()==datum[2])
    return true; else return false;
}


// ------------------------- LYTEBOX ------------------------------------------------------------- //
function startLytebox(href, title, rel)
{
     var el   = document.getElementById('lytebox_misc');
     el.href  = href;
     el.title = title;
     el.rel = rel;
     myLytebox.start(el);
}

// ------------------------- LOADER OFF ---------------------------------------------------------- //
function loaderOff()
{   
    Effect.Fade('loader', {duration: 0.3, afterFinish: function()
    {    
        Effect.Appear('layer', {duration: 1.0}); 
        Effect.Appear('siteContentTopEventLayer', {duration: 1.0}); 
    }
    });     
}

// ------------------------- Navigation - Load Pagecontent (with LOADER) ------------------------- //
function loadSite(site)
{
    Effect.Fade('layer', {duration: 1.0, afterFinish: function()
    {
        Effect.Appear('loader', {duration: 0.3, afterFinish: function() 
        { 
            ob_post.UpdatePanelFromPage('panelContent', 'siteContent', site); 
        }
        });
    }        
    }); 
    
    Effect.Fade('siteContentTopEventLayer', {duration: 1.0, afterFinish: function()
    {
        Effect.Appear('loader', {duration: 0.3, afterFinish: function() 
        {       
            if(site == "01.aspx" || site == "02.aspx")
            {      
                ob_post.UpdatePanelFromPage('siteContentTopEvent', 'siteContentTopEvent', "topeventempty.aspx"); 
            }
            else
            {
                ob_post.UpdatePanelFromPage('siteContentTopEvent', 'siteContentTopEvent', "topevent.aspx"); 
            }
        }
        });
    }        
    });
}

// ------------------------- BIOGRAPHY LANGUAGE ------------------------------------------------- //
var de = true;
var en = false;
var it = false;

function ShowLanguage(language)
{
    if(language == 'de')
    {
        if(en == true)
        {        
            Effect.Fade('en', {duration: 0.0});
            en = false;
        }
        if(it == true)
        {
            Effect.Fade('it', {duration: 0.0});
            it = false;
        }
        
        Effect.Appear(language, {duration: 0.3});
        de = true;        
    }
    if(language == 'en')
    {
        if(de == true)
        {        
            Effect.Fade('de', {duration: 0.0});
            de = false;
        }
        if(it == true)
        {
            Effect.Fade('it', {duration: 0.0});
            it = false;
        }
        
        Effect.Appear(language, {duration: 0.3});
        en = true;        
    }
    if(language == 'it')
    {
        if(en == true)
        {        
            Effect.Fade('en', {duration: 0.0});
            en = false;
        }
        if(de == true)
        {
            Effect.Fade('de', {duration: 0.0});
            de = false;
        }
        
        Effect.Appear(language, {duration: 0.3});
        it = true;        
    }
}


// -------------------------------- PAGING OVERVIEW ------------------------------ //
function previewPage(site)
{   
    ob_post.post(site, "cmdPrev_Click");
    loadSite(site);
}
function nextPage(site)
{
    ob_post.post(site, "cmdNext_Click");
    loadSite(site);
}
function pageUp(site)
{
    ob_post.post(site, "cmdOverview_Click");
    loadSite(site);
}
// -------------------------------- DETAILS GALLERY IMAGES ------------------------------ //
function loadGallery(ID)
{   
    loadSite('22.aspx?GalleryID=' + ID);
}


function loadGalleryOverview(site)
{
    ob_post.post('22.aspx', "cmdOverview_Click");    
    loadSite(site);
}

// -------------------------------- CHECK / SEND FORM NEWSLETTER ------------------------------ //
function CheckFormNewsletter()
{    
    var bEmail = false;
    var bTel = false;
    var bRegion = false;

    if(document.getElementById("tbxNameNL").value == '' || document.getElementById("tbxEmailNL").value == '' || document.getElementById("tbxVornameNL").value == '')
    {
        Effect.Appear('divError', {duration: 0.0});        
        Effect.Fade('divEmail', {duration: 0.0});       
    }
    else
    {
        Effect.Fade('divError', {duration: 0.0});
        
        
        // check Region
                   
        if(document.getElementById("cboRegionsNL").value == '0' )
        {
            Effect.Appear('divRegion', {duration: 0.0}); 
            bRegion = false;           
        }
        else
        {
            bRegion = true;
            Effect.Fade('divRegion', {duration: 0.0}); 
        }
        
        // check Email
        var sEmail = new String(document.getElementById("tbxEmailNL").value);             
        if(!sEmail.match(reEmail))
        {
            Effect.Appear('divEmail', {duration: 0.0}); 
            bEmail = false;           
        }
        else
        {
            bEmail = true;
            Effect.Fade('divEmail', {duration: 0.0}); 
        }
        
        // check Tel
        var sTel = new String(document.getElementById("tbxTelNL").value);
        if(sTel != "" && sTel != "Mobile")
        {
            if(!sTel.match(reTel))
            {
                Effect.Appear('divTel', {duration: 0.0}); 
                bTel = false;           
            }
            else
            {
                bTel = true;
                Effect.Fade('divTel', {duration: 0.0}); 
            }
        }
        else
        {
            bTel = true;
            Effect.Fade('divTel', {duration: 0.0});         
        }
        
        if(bEmail && bTel && bRegion)
        {   
            Effect.Appear('divSent', {duration: 0.0}); 
            document.getElementById("btnSendNL").disabled = true; 
            
            SendFormNewsletter();
        }    
    }
}


function SendFormNewsletter()
{
    ob_post.AddParam("sLastName", document.getElementById("tbxNameNL").value);
    ob_post.AddParam("sFirstName", document.getElementById("tbxVornameNL").value);
    ob_post.AddParam("sEmail", document.getElementById("tbxEmailNL").value);
    if(document.getElementById("tbxTelNL").value == "Mobile")
    { ob_post.AddParam("sTel", ""); }
    else { ob_post.AddParam("sTel", document.getElementById("tbxTelNL").value); }
    ob_post.AddParam("sRegionID", document.getElementById("cboRegionsNL").value);
    
    ob_post.post("greeks-gone-wild.aspx", "SaveForm"); 
}


// -------------------------------- CHECK / SEND FORM CONTACT / BOOKING ------------------------------ //
function CheckFormContact()
{
    var bDate = false;
    var bEmail = false;
    var bTel = false;
    var bRegions = false;

    if(document.getElementById("tbxLastNameContact").value != '' && document.getElementById("tbxFirstNameContact").value != '' && document.getElementById("tbxEmailContact").value != '')
    {
        Effect.Fade('divErrorContact', {duration: 0.0});
        
        // check booking panel
        if(document.getElementById("tbxDateContact") != null && document.getElementById("tbxDateContact").value != '')
        {
            if(CheckDate(document.getElementById("tbxDateContact").value))
            {
                bDate = true;
                Effect.Fade('divDateContact', {duration: 0.0});
            }
            else
            {
                bDate = false;
                Effect.Appear('divDateContact', {duration: 0.0});                 
            }
        }
        else
        {
            bDate = true;     
        }
        
        // check normal Form
        var sEmail = new String(document.getElementById("tbxEmailContact").value);             
        if(!sEmail.match(reEmail))
        {
            bEmail = false; 
            Effect.Appear('divEmailContact', {duration: 0.0});           
        }
        else
        {
            bEmail = true;
            Effect.Fade('divEmailContact', {duration: 0.0}); 
        }
        // check tel
        var sTel = new String(document.getElementById("tbxMobileContact").value);
        if(sTel != "")
        {
            if(!sTel.match(reTel))
            {
                Effect.Appear('divTelContact', {duration: 0.0}); 
                bTel = false;           
            }
            else
            {
                bTel = true;
                Effect.Fade('divTelContact', {duration: 0.0}); 
            }
        }
        else
        {
            bTel = true;
            Effect.Fade('divTelContact', {duration: 0.0});         
        }
        
        if(document.getElementById("chkBoxNewsletterContact").checked)
        {
            if(document.getElementById("cboRegionsContact").value == '0')
            {
                bRegions = false;
                Effect.Appear('divRegionContact', {duration: 0.0});                
            }
            else
            {
                bRegions = true;
                Effect.Fade('divRegionContact', {duration: 0.0});            
            }
        }
        else
        {
            bRegions = true;
            Effect.Fade('divRegionContact', {duration: 0.0});     
        }

        if (bEmail && bDate && bTel && bRegions) 
        {

          // check captcha
          if (ob_post.post("captcha.aspx", "CheckCaptcha", null, { "sCaptchaText": document.getElementById("captchaText").value })) 
          {
            bCaptchaFAQ = true;
            Effect.Fade('divCaptchaError', { duration: 0.0 });
          }
          else 
          {
            bCaptchaFAQ = false;
            Effect.Appear('divCaptchaError', { duration: 0.0 });

            updateImage('captchaImgPlaceholder', '../cms/PageModules/Captcha/Captcha.aspx');
            return;
           }
           
           Effect.Fade('divDateContact', {duration: 0.0});
           Effect.Fade('divEmailContact', {duration: 0.0});
           Effect.Fade('divTelContact', {duration: 0.0}); 
           Effect.Fade('divRegionContact', {duration: 0.0}); 
            
           Effect.Appear('divSentContact', {duration: 0.0}); 
           document.getElementById("btnSendContact").disabled = true; 
           
           SendContactEmail();      
        }        
    }
    else
    {    
        Effect.Appear('divErrorContact', {duration: 0.0});   
    }
}

function SendContactEmail()
{
    // check Date
    if(document.getElementById("tbxDateContact") != null && document.getElementById("tbxDateContact").value != '')
    { ob_post.AddParam("sDate", document.getElementById("tbxDateContact").value); }
    else { ob_post.AddParam("sDate", ""); } 
    // check Booking
    if(document.getElementById("chkBoxBooking") != null && document.getElementById("chkBoxBooking").value != '')
    { ob_post.AddParam("sBooking", document.getElementById("chkBoxBooking").value); }
    else { ob_post.AddParam("sBooking", ""); }
    // check Location    
    if(document.getElementById("tbxLocationContact") != null && document.getElementById("tbxLocationContact").value != '')
    { ob_post.AddParam("sLocation", document.getElementById("tbxLocationContact").value); }
    else { ob_post.AddParam("sLocation", ""); }
    // check Party
    if(document.getElementById("tbxPartynameContact") != null && document.getElementById("tbxPartynameContact").value != '')
    { ob_post.AddParam("sPartyname", document.getElementById("tbxPartynameContact").value); }
    else { ob_post.AddParam("sPartyname", ""); }
    // check DJ
    if(document.getElementById("cboDJs") != null && document.getElementById("cboDJs").value != '')
    { ob_post.AddParam("sDJ", document.getElementById("cboDJs").value); }
    else { ob_post.AddParam("sDJ", ""); } 
       
    ob_post.AddParam("sEmail", document.getElementById("tbxEmailContact").value); 
                
    ob_post.AddParam("sFirstName", document.getElementById("tbxFirstNameContact").value); 
    ob_post.AddParam("sLastName", document.getElementById("tbxLastNameContact").value);  
    ob_post.AddParam("sComment", document.getElementById("tbxCommentContact").value); 
    ob_post.AddParam("bEntryNewsletter", document.getElementById("chkBoxNewsletterContact").checked); 
    ob_post.AddParam("sTel", document.getElementById("tbxMobileContact").value); 
    ob_post.AddParam("sRegionID", document.getElementById("cboRegionsContact").value);
    
    ob_post.post("06.aspx", "SendEmail");  
}

// --------------------------- Select Guestlist ------------------------------------- //
function selectFriendslist(ID)
{
    loadSite('20.aspx?AgendaID=' + ID);  
}


// --------------------------- Change Guestlistinfo  -------------------------------- //
function SelectGuestlistInfo()
{
    //submittedGL = 0;
    var ID = document.getElementById("ctl14").value;
        
    loadSite('20.aspx?AgendaID=' + ID);  
}
// ------------------------- SendForm GUESTLIST ------------------------------------- //
function CheckGuestlistEntry(ID)
{    
    var bEmailGL = false;
    var bAgeGL = false;
    var bTelGL = false;
    var bRegionGL = false;
        
    if(document.getElementById("tbxNameGL").value == '' || document.getElementById("tbxEmailGL").value == '' || document.getElementById("tbxVornameGL").value == '' || document.getElementById("tbxAgeGL").value == '')
    {
        Effect.Appear('divErrorGL', {duration: 0.0});
    }
    else
    {
        var sEmail = new String(document.getElementById("tbxEmailGL").value);            
        if(!sEmail.match(reEmail))
        {
            bEmailGL = false;
            
            Effect.Fade('divErrorGL', {duration: 0.0}); 
            Effect.Appear('divEmailGL', {duration: 0.0});            
        }
        else
        {
            bEmailGL = true;
            Effect.Fade('divEmailGL', {duration: 0.0}); 
        }
        
        var sAge = document.getElementById("tbxAgeGL").value;            
        if(!sAge.match(reYear))
        {
            bAgeGL = false;
            Effect.Appear('divAgeGL', {duration: 0.0});   
        }
        else
        {
            bAgeGL = true;
            Effect.Fade('divAgeGL', {duration: 0.0});     
        }
                    
        if( document.getElementById("tbxMobileGL").value != "")
        {
            bTel = false;
            
            var sTel = document.getElementById("tbxMobileGL").value;
            if(!sTel.match(reTel))
            {
                bTelGL = false;
                Effect.Appear('divTelGL', {duration: 0.0}); 
            }
            else
            {
                bTelGL = true;
                Effect.Fade('divTelGL', {duration: 0.0});     
            }
        }
        else
        {
            bTelGL = true;  
            Effect.Fade('divTelGL', {duration: 0.0});    
        }
                
        if(document.getElementById("chkBoxNewsletterGL").checked)
        {            
            if(document.getElementById("cboRegionsGL").value == '0')
            {
                bRegionGL = false;
                Effect.Appear('divRegionGL', {duration: 0.0});                
            }
            else
            {
                bRegionGL = true;
                Effect.Fade('divRegionGL', {duration: 0.0});            
            }
        }
        else
        {
            bRegionGL = true; 
            Effect.Fade('divRegionGL', {duration: 0.0}); 
        }
        
        if(bAgeGL && bTelGL && bEmailGL && bRegionGL)
        {
            Effect.Fade('divErrorGL', {duration: 0.0});  
            Effect.Appear('divSentGL', {duration: 0.0});  
            
            document.getElementById("sendButtonGL").disabled = true;       
            SaveGuestlistEntry(ID);
                                  
        }   
    }
}

function SaveGuestlistEntry(ID)
{
    ob_post.AddParam("bInsertNewsletter", document.getElementById("chkBoxNewsletterGL").checked);
    ob_post.AddParam("sName", document.getElementById("tbxNameGL").value);    
    ob_post.AddParam("sVorname", document.getElementById("tbxVornameGL").value);
    if(document.getElementById("cboCompanionsGL") != null)
    { ob_post.AddParam("sCompanions", document.getElementById("cboCompanionsGL").value); }
    else { ob_post.AddParam("sCompanions", ""); }
    ob_post.AddParam("sGender", document.getElementById("cboGenderGL").value);
    ob_post.AddParam("sAge", document.getElementById("tbxAgeGL").value);
    ob_post.AddParam("sMobile", document.getElementById("tbxMobileGL").value);
    ob_post.AddParam("sEmail", document.getElementById("tbxEmailGL").value);
    ob_post.AddParam("sRegion", document.getElementById("cboRegionsGL").value);
        
    ob_post.post("20.aspx?AgendaID=" + ID, "SaveForm");     
}
// ------------------------- SendForm FAQ ------------------------------------- //
function CheckFAQEntry(ID)
{    
    var bEmailFAQ = false;
    var bTelFAQ = false;
    var bRegionFAQ = false;
    var bCaptchaFAQ = false;
        
    if(document.getElementById("tbxNameFAQ").value == '' || document.getElementById("tbxEmailFAQ").value == '' || document.getElementById("tbxVornameFAQ").value == '' || document.getElementById("tbxCommentFAQ").value == '')
    {
        Effect.Appear('divErrorFAQ', {duration: 0.0});
    }
    else
    {
        Effect.Fade('divErrorFAQ', {duration: 0.0});
        
        var sEmail = new String(document.getElementById("tbxEmailFAQ").value);            
        if(!sEmail.match(reEmail))
        {
            bEmailFAQ = false;
            
            Effect.Fade('divErrorFAQ', {duration: 0.0}); 
            Effect.Appear('divEmailFAQ', {duration: 0.0});            
        }
        else
        {
            bEmailFAQ = true;
            Effect.Fade('divEmailFAQ', {duration: 0.0}); 
        }
                    
        if( document.getElementById("tbxMobileFAQ").value != "")
        {
            bTel = false;
            
            var sTel = document.getElementById("tbxMobileFAQ").value;
            if(!sTel.match(reTel))
            {
                bTelFAQ = false;
                Effect.Appear('divTelFAQ', {duration: 0.0}); 
            }
            else
            {
                bTelFAQ = true;
                Effect.Fade('divTelFAQ', {duration: 0.0});     
            }
        }
        else
        {
            bTelFAQ = true;  
            Effect.Fade('divTelFAQ', {duration: 0.0});    
        }
                
        if(document.getElementById("chkBoxNewsletterFAQ").checked)
        {            
            if(document.getElementById("cboRegionsFAQ").value == '0')
            {
                bRegionFAQ = false;
                Effect.Appear('divRegionFAQ', {duration: 0.0});                
            }
            else
            {
                bRegionFAQ = true;
                Effect.Fade('divRegionFAQ', {duration: 0.0});            
            }
        }
        else
        {
            bRegionFAQ = true; 
            Effect.Fade('divRegionFAQ', {duration: 0.0}); 
        }


        if (bTelFAQ && bEmailFAQ && bRegionFAQ) 
        {
          // check captcha
          if (ob_post.post("captcha.aspx", "CheckCaptcha", null, { "sCaptchaText": document.getElementById("captchaText").value })) 
          {
            bCaptchaFAQ = true;
            Effect.Fade('divCaptchaError', { duration: 0.0 });
          }
          else 
          {
            bCaptchaFAQ = false;
            Effect.Appear('divCaptchaError', { duration: 0.0 });

            updateImage('captchaImgPlaceholder', '../cms/PageModules/Captcha/Captcha.aspx');
            return;
          }
          
          Effect.Fade('divErrorFAQ', { duration: 0.0 });
          Effect.Appear('divSentFAQ', { duration: 0.0 });

          document.getElementById("sendButtonFAQ").disabled = true;
          SaveFAQEntry(ID);

        }
        else {
          //updateImage('captchaImgPlaceholder', '../cms/PageModules/Captcha/Captcha.aspx?Random=' + Math.random(1));
        } 
    }
}

function SaveFAQEntry(ID)
{
    ob_post.AddParam("bInsertNewsletter", document.getElementById("chkBoxNewsletterFAQ").checked);
    ob_post.AddParam("sName", document.getElementById("tbxNameFAQ").value);    
    ob_post.AddParam("sVorname", document.getElementById("tbxVornameFAQ").value);    
    ob_post.AddParam("sMobile", document.getElementById("tbxMobileFAQ").value);
    ob_post.AddParam("sEmail", document.getElementById("tbxEmailFAQ").value);
    ob_post.AddParam("sComment", document.getElementById("tbxCommentFAQ").value);
    ob_post.AddParam("sRegion", document.getElementById("cboRegionsFAQ").value);
        
    ob_post.post("faq.aspx?BoxID=" + ID, "SendEmail");     
}
// ------------------------- SendForm COMPETITION ------------------------------------- //
function CheckCompetitionEntry(ID)
{    
    var bEmailCompetition = false;
    var bAgeCompetition = false;
    var bTelCompetition = false;
    var bRegionCompetition = false;
        
    if(document.getElementById("tbxNameCompetition").value == '' || document.getElementById("tbxEmailCompetition").value == '' || document.getElementById("tbxVornameCompetition").value == '' || document.getElementById("tbxAgeCompetition").value == '')
    {
        Effect.Appear('divErrorCompetition', {duration: 0.0});
    }
    else
    {
        var sEmail = new String(document.getElementById("tbxEmailCompetition").value);            
        if(!sEmail.match(reEmail))
        {
            bEmailCompetition = false;
            
            Effect.Fade('divErrorCompetition', {duration: 0.0}); 
            Effect.Appear('divEmailCompetition', {duration: 0.0});            
        }
        else
        {
            bEmailCompetition = true;
            Effect.Fade('divEmailCompetition', {duration: 0.0}); 
        }
        
        var sAge = document.getElementById("tbxAgeCompetition").value;            
        if(!sAge.match(reYear))
        {
            bAgeCompetition = false;
            Effect.Appear('divAgeCompetition', {duration: 0.0});   
        }
        else
        {
            bAgeCompetition = true;
            Effect.Fade('divAgeCompetition', {duration: 0.0});     
        }
                    
        if( document.getElementById("tbxMobileCompetition").value != "")
        {
            bTelCompetition = false;
            
            var sTel = document.getElementById("tbxMobileCompetition").value;
            if(!sTel.match(reTel))
            {
                bTelCompetition = false;
                Effect.Appear('divTelCompetition', {duration: 0.0}); 
            }
            else
            {
                bTelCompetition = true;
                Effect.Fade('divTelCompetition', {duration: 0.0});     
            }
        }
        else
        {
            bTelCompetition = true;  
            Effect.Fade('divTelCompetition', {duration: 0.0});    
        }
                
        if(document.getElementById("chkBoxNewsletterCompetition").checked)
        {            
            if(document.getElementById("cboRegionsCompetition").value == '0')
            {
                bRegionCompetition = false;
                Effect.Appear('divRegionCompetition', {duration: 0.0});                
            }
            else
            {
                bRegionCompetition = true;
                Effect.Fade('divRegionCompetition', {duration: 0.0});            
            }
        }
        else
        {
            bRegionCompetition = true; 
            Effect.Fade('divRegionCompetition', {duration: 0.0}); 
        }

        if (bAgeCompetition && bTelCompetition && bEmailCompetition && bRegionCompetition) 
        {
          // check captcha
          if (ob_post.post("captcha.aspx", "CheckCaptcha", null, { "sCaptchaText": document.getElementById("captchaText").value }))
          {
            bCaptchaFAQ = true;
            Effect.Fade('divCaptchaError', { duration: 0.0 });
          }
          else
          {
            bCaptchaFAQ = false;
            Effect.Appear('divCaptchaError', { duration: 0.0 });

            updateImage('captchaImgPlaceholder', '../cms/PageModules/Captcha/Captcha.aspx');
            return;
          }
          
          Effect.Fade('divErrorCompetition', {duration: 0.0});  
          Effect.Appear('divSentCompetition', {duration: 0.0});  
          
          document.getElementById("sendButtonCompetition").disabled = true;       
          SaveCompetitionEntry(ID);
                                  
        }   
    }
}

function SaveCompetitionEntry(ID)
{
    ob_post.AddParam("bInsertNewsletter", document.getElementById("chkBoxNewsletterCompetition").checked);
    ob_post.AddParam("sName", document.getElementById("tbxNameCompetition").value);    
    ob_post.AddParam("sVorname", document.getElementById("tbxVornameCompetition").value);
    if(document.getElementById("cboCompanionsCompetition") != null)
    { ob_post.AddParam("sCompanions", document.getElementById("cboCompanionsCompetition").value); }
    else { ob_post.AddParam("sCompanions", ""); }
    ob_post.AddParam("sGender", document.getElementById("cboGenderCompetition").value);
    ob_post.AddParam("sAge", document.getElementById("tbxAgeCompetition").value);
    ob_post.AddParam("sMobile", document.getElementById("tbxMobileCompetition").value);
    ob_post.AddParam("sEmail", document.getElementById("tbxEmailCompetition").value);
    ob_post.AddParam("sRegion", document.getElementById("cboRegionsCompetition").value);
        
    ob_post.post("competition.aspx?BoxID=" + ID, "SaveForm");     
}

// ------------------------- SendForm SPECIAL ------------------------------------- //
function CheckSpecialEntry(ID)
{    
    var bEmailSpecial = false;
    var bAgeSpecial = false;
    var bTelSpecial = false;
    var bCaptchaSpecial = false;
        
    if(document.getElementById("captchaText").value == '' || document.getElementById("tbxNameSpecial").value == '' || document.getElementById("tbxEmailSpecial").value == '' || document.getElementById("tbxVornameSpecial").value == '' || document.getElementById("tbxAgeSpecial").value == '' || document.getElementById("tbxCommentSpecial").value == '')
    {
        Effect.Appear('divErrorSpecial', {duration: 0.0});
    }
    else
    {
        var sEmail = new String(document.getElementById("tbxEmailSpecial").value);            
        if(!sEmail.match(reEmail))
        {
            bEmailSpecial = false;
            
            Effect.Fade('divErrorSpecial', {duration: 0.0}); 
            Effect.Appear('divEmailSpecial', {duration: 0.0});            
        }
        else
        {
            bEmailSpecial = true;
            Effect.Fade('divEmailSpecial', {duration: 0.0}); 
        }
        
        var sAge = document.getElementById("tbxAgeSpecial").value;            
        if(!sAge.match(reYear))
        {
            bAgeSpecial = false;
            Effect.Appear('divAgeSpecial', {duration: 0.0});   
        }
        else
        {
            bAgeSpecial = true;
            Effect.Fade('divAgeSpecial', {duration: 0.0});     
        }
                    
        if( document.getElementById("tbxMobileSpecial").value != "")
        {
            bTelSpecial = false;
            
            var sTel = document.getElementById("tbxMobileSpecial").value;
            if(!sTel.match(reTel))
            {
                bTelSpecial = false;
                Effect.Appear('divTelSpecial', {duration: 0.0}); 
            }
            else
            {
                bTelSpecial = true;
                Effect.Fade('divTelSpecial', {duration: 0.0});     
            }
        }
        else
        {
            bTelSpecial = true;  
            Effect.Fade('divTelSpecial', {duration: 0.0});    
        }


        if (bAgeSpecial && bTelSpecial && bEmailSpecial) 
        {
          // check captcha
          if (ob_post.post("captcha.aspx", "CheckCaptcha", null, { "sCaptchaText": document.getElementById("captchaText").value })) 
          {
            bCaptchaFAQ = true;
            Effect.Fade('divCaptchaError', { duration: 0.0 });
          }
          else 
          {
            bCaptchaFAQ = false;
            Effect.Appear('divCaptchaError', { duration: 0.0 });

            updateImage('captchaImgPlaceholder', '../cms/PageModules/Captcha/Captcha.aspx');
            return;
          }
          
          //alert("save = true");
          
          Effect.Fade('divErrorSpecial', {duration: 0.0});  
          Effect.Appear('divSentSpecial', {duration: 0.0});  
          
          document.getElementById("sendButtonSpecial").disabled = true;       
          SaveSpecialEntry(ID);                                  
        }   
    }
}

function SaveSpecialEntry(ID)
{
    ob_post.AddParam("sName", document.getElementById("tbxNameSpecial").value);    
    ob_post.AddParam("sVorname", document.getElementById("tbxVornameSpecial").value);
    ob_post.AddParam("sAge", document.getElementById("tbxAgeSpecial").value);
    ob_post.AddParam("sMobile", document.getElementById("tbxMobileSpecial").value);
    ob_post.AddParam("sEmail", document.getElementById("tbxEmailSpecial").value);
    ob_post.AddParam("sComment", document.getElementById("tbxCommentSpecial").value);
    
    ob_post.post("special.aspx?BoxID=" + ID, "SendEmailToWebmaster");
}
// ------------------------- SendForm RESERVATION ------------------------------------- //
function CheckReservationEntry(ID)
{    
    var bEmailReservation = false;
    var bAgeReservation = false;
    var bTelReservation = false;
    var bCaptchaReservation = false;
        
    if(document.getElementById("captchaText").value == '' || document.getElementById("tbxNameReservation").value == '' || document.getElementById("tbxEmailReservation").value == '' || document.getElementById("tbxVornameReservation").value == '' || document.getElementById("tbxAgeReservation").value == '' || document.getElementById("tbxCommentReservation").value == '')
    {
        Effect.Appear('divErrorReservation', {duration: 0.0});
    }
    else
    {
        var sEmail = new String(document.getElementById("tbxEmailReservation").value);            
        if(!sEmail.match(reEmail))
        {
            bEmailReservation = false;
            
            Effect.Fade('divErrorReservation', {duration: 0.0}); 
            Effect.Appear('divEmailReservation', {duration: 0.0});            
        }
        else
        {
            bEmailReservation = true;
            Effect.Fade('divEmailReservation', {duration: 0.0}); 
        }
        
        var sAge = document.getElementById("tbxAgeReservation").value;            
        if(!sAge.match(reYear))
        {
            bAgeReservation = false;
            Effect.Appear('divAgeReservation', {duration: 0.0});   
        }
        else
        {
            bAgeReservation = true;
            Effect.Fade('divAgeReservation', {duration: 0.0});     
        }
                    
        if( document.getElementById("tbxMobileReservation").value != "")
        {
            bTelReservation = false;
            
            var sTel = document.getElementById("tbxMobileReservation").value;
            if(!sTel.match(reTel))
            {
                bTelReservation = false;
                Effect.Appear('divTelReservation', {duration: 0.0}); 
            }
            else
            {
                bTelReservation = true;
                Effect.Fade('divTelReservation', {duration: 0.0});     
            }
        }
        else
        {
            bTelReservation = true;  
            Effect.Fade('divTelReservation', {duration: 0.0});    
        }
        

        if (bAgeReservation && bTelReservation && bEmailReservation) 
        {
          // check captcha
          if (ob_post.post("captcha.aspx", "CheckCaptcha", null, { "sCaptchaText": document.getElementById("captchaText").value })) 
          {
            bCaptchaFAQ = true;
            Effect.Fade('divCaptchaError', { duration: 0.0 });
          }
          else 
          {
            bCaptchaFAQ = false;
            Effect.Appear('divCaptchaError', { duration: 0.0 });

            updateImage('captchaImgPlaceholder', '../cms/PageModules/Captcha/Captcha.aspx');
            return;
          }
          Effect.Fade('divErrorReservation', {duration: 0.0});  
          Effect.Appear('divSentReservation', {duration: 0.0});  
          
          document.getElementById("sendButtonReservation").disabled = true;       
          SaveReservationEntry(ID);
                                  
        }   
    }
}

function SaveReservationEntry(ID)
{
    ob_post.AddParam("sName", document.getElementById("tbxNameReservation").value);    
    ob_post.AddParam("sVorname", document.getElementById("tbxVornameReservation").value);
    ob_post.AddParam("sAge", document.getElementById("tbxAgeReservation").value);
    ob_post.AddParam("sMobile", document.getElementById("tbxMobileReservation").value);
    ob_post.AddParam("sEmail", document.getElementById("tbxEmailReservation").value);
    ob_post.AddParam("sComment", document.getElementById("tbxCommentReservation").value);
    
    ob_post.post("reservation.aspx?BoxID=" + ID, "SendEmailToWebmaster")
}

// ------------------------- UPDATE CAPTCHA IMAGE  ------------------------------------- //
function updateImage(img, text)
{
  var image = document.getElementById(img);
  image.src = text + '?Random=' + Math.random(1);
}

// ------------------------- SLIDE ARTISTS  ------------------------------------- //

function SlideArtist(ID)
{    
    Effect.toggle('slideDiv_' + ID, 'blind'); 
}

// ----------------------------- ECRADS  ---------------------------------------- //
function PopUpPostcard(image, ID)
{
    popUpWin = window.open('ecard.aspx?Image=' + image + '&Gallery=' + ID,'popWin','resizeable=no,scrollbars=yes,width=750,height=650');
    popUpWin.focus();
}
function PopUpPostcardEvents(image)
{
    popUpWin = window.open('ecard.aspx?Image=' + image + '&Gallery=Events','popWin','resizeable=no,scrollbars=yes,width=750,height=650');
    popUpWin.focus();
}
function PopUpPostcardNews(image)
{
    popUpWin = window.open('ecard.aspx?Image=' + image + '&Gallery=News','popWin','resizeable=no,scrollbars=yes,width=750,height=650');
    popUpWin.focus();
}
function closePopUp()
{
    window.close();
}

// ----------------------------- Mouseover Text Effects -------------------------------- //
var mouseOver = false;

function startTyping(textParam, delayParam, destinationParam)
{
    var currentChar = 1;

    text = textParam;
    delay = delayParam;
    destination = destinationParam;
        
    mouseOver = true;        
    type(currentChar);
}

function type(currentChar)
{
  if (document.getElementById)
  {
    var dest = document.getElementById(destination);
    
    if (dest)
    {
      dest.innerHTML = text.substr(0, currentChar);
      currentChar++;    
            
      if (currentChar>text.length)
      {
        currentChar = 1;
      }
      else
      {               
        setTimeout(e = function(){if (mouseOver) type(currentChar)}, delay);        
      }
    }
  }
}

function restoreLinkText(text, destination)
{   
    mouseOver = false;
    document.getElementById(destination).innerHTML = text;
}



