﻿var contentDivs = new Array();

function Tabsinit() {
    var tabList = document.getElementById('newsTabsNav').childNodes;
    var i;
    var tid;
    for (i = 0; i < tabList.length; i++) {
        if (tabList[i].nodeName == "LI") {
            tid = tabList[i].id.substring(4);
            contentDivs[tid] = document.getElementById(tid);
        }
    }
    i = 0;
    for (tid in contentDivs) {
        if (tid != 'indexOf') {
            if (i !== 0) {
                contentDivs[tid].className = 'tabContent hide';
                document.getElementById(('tab-' + tid)).className = '';
            }
            else {
                contentDivs[tid].className = 'tabContent';
                document.getElementById(('tab-' + tid)).className = 'sticky';
            }
        }
        i++;
    }
    showTab('shownews');
}

function showTab(tab) {
    for (var tid in contentDivs) {
        if (tid != 'indexOf') {
            if (tid == tab) {
                contentDivs[tid].className = 'tabContent';
                document.getElementById(('tab-' + tid)).className = 'sticky';
            } else {
                contentDivs[tid].className = 'tabContent hide';
                document.getElementById(('tab-' + tid)).className = '';
            }
        }
    }
}

function switchInterestPage() {

    if (document.getElementById('IntColLeftPage2').className == 'AttractionsList AttractionsColLeft hide' && document.getElementById('IntColRightPage2').className == 'AttractionsList AttractionsColRight hide') {
        document.getElementById('IntColLeftPage2').className = 'AttractionsList AttractionsColLeft';
        document.getElementById('IntColRightPage2').className = 'AttractionsList AttractionsColRight';
        document.getElementById('IntColLeftPage1').className = 'AttractionsList AttractionsColLeft hide';
        document.getElementById('IntColRightPage1').className = 'AttractionsList AttractionsColRight hide';

        document.getElementById('pager').innerHTML = '<a href="Javascript:switchInterestPage();">Previous Page</a>';
        
    }
    else {
        document.getElementById('IntColLeftPage2').className = 'AttractionsList AttractionsColLeft hide';
        document.getElementById('IntColRightPage2').className = 'AttractionsList AttractionsColRight hide';
        document.getElementById('IntColLeftPage1').className = 'AttractionsList AttractionsColLeft';
        document.getElementById('IntColRightPage1').className = 'AttractionsList AttractionsColRight';
        document.getElementById('pager').innerHTML = '<a href="Javascript:switchInterestPage();">Next Page</a>';
    }

}

function SearchBoats(){
    var params = '?';
    if (document.getElementById('tabsCondition').value.length > 1) { params += 'Condition=' + document.getElementById('tabsCondition').value}
    if (document.getElementById('tabsBrand').value.length > 1) { params += '&Brand="' + document.getElementById('tabsBrand').value + "\""} 
    if (document.getElementById('tabsModel').value.length > 1) { params += '&Model="' + document.getElementById('tabsModel').value + "\""} 
    if (document.getElementById('tabsType').value.length > 1) { params += '&Type="' + document.getElementById('tabsType').value + "\""} 
    if (document.getElementById('tabsLength').value.length > 1) { params += '&Length="' + document.getElementById('tabsLength').value + "\""}    if (document.getElementById('tabsDebut').value.length > 1) { params += '&Debut="' + document.getElementById('tabsDebut').value + "\""} 
    //alert(document.getElementById('Condition').value);
    //window.location='/2011/show_information/boats_at_the_show.aspx?Condition=' + document.getElementById('Condition').value
    window.location='http://www.southamptonboatshow.com/dev.aspx' + params;
}
