function BenaUrls(code)
{
            switch (code)
            {
                case "rundgang": 
                    OpenDialog('http://www.bena.at/deutsch/LocationsServices/Rundgang/tabid/440/Default.aspx','VirtuellerRundgang',640,480);
                    break;
                    
                case "home":
                    document.location.href = 'http://www.virtualoffice.at';
                    break;
            }
        }
       
function My_SendContactForm() { 
    
    var valid = true;
    
    /*if ($F('company') == '')
    {
        valid = false;
        $('company').addClassName('missing');
    }
    else
    {
        $('company').removeClassName('missing');
    }
    
    if ($F('firstname') == '')
    {
        valid = false;
        $('firstname').addClassName('missing');
    }
    else
    {
        $('firstname').removeClassName('missing');
    }
    */
    
    if ($F('lastname') == 'Nachname' || $F('lastname') == '')
    {
        valid = false;
        $('lastname').addClassName('missing');
    }
    else
    {
        $('lastname').removeClassName('missing');
    }
    
    if ($F('email') == '')
    {
        valid = false;
        $('email').addClassName('missing');
    }
    else
    {
        $('email').removeClassName('missing');
    }
    if ($F('phone') == ''){
        valid = false;
        $('phone').addClassName('missing');
    } else {
        $('phone').removeClassName('missing');
    }

    var comment = $('comment') ? $F('comment') : '';
    var infoVO = $('infoVO') ? $F('infoVO') : '';
    var typeVO = $('typeVO') ? $F('typeVO') : '';
    var infoTS = $('infoTS') ? $F('infoTS') : '';
    var infoS = $('infoS') ? $F('infoS') : '';
    var typeS = $('typeS') ? $F('typeS') : '';


    if (!valid) return;

    new Ajax.Request('http://www.virtualoffice.at/portals/sendContactMail.aspx', { 
        onSuccess: My_ContactFormSent, method: 'post', 
        parameters: { 
            page: 'virtualoffice',
            company: $F('company'), 
            title: $F('title'), 
            firstname: $F('firstname'), 
            lastname: $F('lastname'), 
            email: $F('email'), 
            phone: $F('phone'), 
            comment: comment,
            infoVO: infoVO,
            typeVO: typeVO, 
            infoTS: infoTS, 
            infoS: infoS, 
            typeS: typeS, 
            location: $F('location')
     }}); 
     document.location.href = '/default.aspx?tabid=758';
} 

function My_SendContactForm_SIDE () { 
    
    var valid = true;
    
    if ($F('lastname_side') == 'Nachname' || $F('lastname_side') == ''){
        valid = false;
        $('lastname_side').addClassName('missing');
    } else {
        $('lastname_side').removeClassName('missing');
    }
    
    if ($F('email_side') == ''){
        valid = false;
        $('email_side').addClassName('missing');
    } else {
        $('email_side').removeClassName('missing');
    }
	
    if ($F('phone_side') == ''){
        valid = false;
        $('phone_side').addClassName('missing');
    } else {
        $('phone_side').removeClassName('missing');
    }

    if (!valid) return;

    var comment = $('comment_side') ? $F('comment_side') : '';
    var infoVO = 'on';
    var typeVO = $('typeVO_side') ? $F('typeVO_side') : '';
    var infoTS = $('infoTS_side') ? $F('infoTS_side') : '';
    var infoS = $('infoS_side') ? $F('infoS_side') : '';
    var typeS = $('typeS_side') ? $F('typeS_side') : '';
    
    new Ajax.Request('http://www.virtualoffice.at/portals/sendContactMail.aspx', { 
        onSuccess: My_ContactFormSent, method: 'post', 
        parameters: { 
            page: 'virtualoffice',
            company: $F('company_side'), 
            title: $F('title_side'), 
            firstname: $F('firstname_side'), 
            lastname: $F('lastname_side'), 
            email: $F('email_side'), 
            phone: $F('phone_side'), 
            comment: comment,
            infoVO: infoVO, 
            typeVO: typeVO, 
            infoTS: infoTS, 
            infoS: infoS, 
            typeS: typeS, 
            location: $F('location_side')
     }}); 
     document.location.href = '/default.aspx?tabid=758';
} 


function CheckMandatory(id) {
            if ($F(id) == '')
            {
                $(id).addClassName('missing');
                return false;
            }
            else
            {
                $(id).removeClassName('missing');
                return true;
            }
        }


function InfoRequest() {
            
            var valid = true;
            var mandatory = ['cfname', 'cfemail'];
            
            for (var i = 0; i < mandatory.length; i++) {
                var s = CheckMandatory(mandatory[i]);
                if (!s) valid = false;
            }
            
           if (!valid) return;
            
            var offices = '';
            var cfoffices = ['all', 'sky360', 'graben19', 'cityport11', 'fischhof3', 'nineteen'];
            
            for (var i = 0; i < cfoffices.length; i++) {
                if ($('cf' + cfoffices[i]).checked) {
                    if (offices != '')
                        offices += ', ';
                    offices += cfoffices[i];
                }                
            }                
            
            new Ajax.Request('http://www.virtualoffice.at/Portals/sendContactMail.aspx', {
                onSuccess: My_ContactFormSent, 
                method: 'post', 
                parameters: { page: 'virtualofficeInfo', gender: ($('cfgenderfemale').checked ? 'f' : 'm'), company: $F('cfcompany'), name: $F('cfname'), email: $F('cfemail'), phone: $F('cfphone'), 
                    offices: offices }});
        }        

function My_ContactFormSent() { document.location.href = 'http://www.virtualoffice.at/Default.aspx?tabid=758'; }

var tabs_en = [745,746,747,748,750,751,752,753,756,754,755];
var tabs_de = [537,539,540,541,718,542,543,719,547,545,546];

function GetTabForLang(lang) 
{            
    if (lang == 'en')
    {
        for (var i = 0; i < tabs_de.length; i++)
            if (tabs_de[i] == currentTabId && tabs_en[i] > 0) return tabs_en[i];
        
        return 745;
    }
    else
    {
        for (var i = 0; i < tabs_en.length; i++)
            if (tabs_en[i] == currentTabId && tabs_de[i] > 0) return tabs_de[i];
        
        return 537;
    }                    
}