﻿secs = 2;
menuHover = false;

function resetTimer() {
    secs = 2;
}

function timer() {
    try {
        if (secs == 2) {
            clearTimeout(dd);
        }
    }
    catch (err) { }

    if (secs > 0) {
        secs -= 1;
        dd = setTimeout("timer(" + secs + ")", 1000);

        if (menuHover == true)
            secs = 2;

        if (secs == 0)
            document.getElementById('property-drop-menu').style.display = 'none';
    }
}

function imIn() {
    menuHover = true;
}

function imOut() {
    menuHover = false;
}


function showDiv(divNo) {

    document.getElementById('tab1').style.display = 'inline';
    document.getElementById('tab2').style.display = 'inline';
    document.getElementById('tab3').style.display = 'inline';
    document.getElementById('tab4').style.display = 'inline';

    document.getElementById('think-content').style.display = 'none';
    document.getElementById('cfp-content').style.display = 'none';
    document.getElementById('core-content').style.display = 'none';
    document.getElementById('vebra-content').style.display = 'none';

    switch (divNo) {
        case 1:
            document.getElementById('think-content').style.display = 'inline';
            document.getElementById('tab1').style.display = 'none';
            break;
        case 2:
            document.getElementById('cfp-content').style.display = 'inline';
            document.getElementById('tab2').style.display = 'none';
            break;
        case 3:
            document.getElementById('core-content').style.display = 'inline';
            document.getElementById('tab3').style.display = 'none';
            break;
        case 4:
            document.getElementById('vebra-content').style.display = 'inline';
            document.getElementById('tab4').style.display = 'none';
            break;
        default:
            //code to be executed if n is different from case 1 and 2
    }

}

function openPopup(url, w, h) {
    width = w;
    height = h;
    x = parseInt(screen.width / 2.0) - (width / 2.0);
    y = parseInt(screen.height / 2.0) - (height / 2.0);

    var win = window.open(url, "editorPopup", "top=" + y + ",left=" + x + ",scrollbars=no,dialog=yes,minimizable=no,modal=yes,width=" + width + ",height=" + height + ",resizable=no");
}

function openPopupImages(url, w, h) {
    width = w;
    height = h;
    x = parseInt(screen.width / 2.0) - (width / 2.0);
    y = parseInt(screen.height / 2.0) - (height / 2.0);

    var win = window.open(url, "editorPopup", "top=" + y + ",left=" + x + ",scrollbars=yes,dialog=yes,minimizable=no,modal=yes,width=" + width + ",height=" + height + ",resizable=yes");
}

function deleteZoneContent(ZoneArea, PageID) {

    ret = henderson.DeleteContent.DeleteZone(ZoneArea, PageID, OnComplete, OnTimeOut, OnError);
    return (true);

}

function OnComplete(args) {
    alert(args);
}

function OnTimeOut(args) {
    alert("ERROR : Service call timed out. Possbily content area has no content.");

}

function OnError(args) {
    alert("Error calling service method.");
}

$(document).ready(
		function() {
		    $('ul#images').innerfade({
		        speed: 1000,
		        timeout: 5000,
		        type: 'sequence',
		        containerheight: '195px'
		    });
		});

		$(document).ready(function() {
		    var $div = $('#menuItems');
		    $div.slideDown(600);
		});

$(function() {
    var tabContainers = $('div.tabs > div');
    tabContainers.hide().filter(':first').show();

    $('div.tabs ul.tabNavigation a').click(function() {
        tabContainers.hide();
        tabContainers.removeClass('on');
        tabContainers.filter(this.hash).show();
        $('div.tabs ul.tabNavigation li').removeClass('on');
        $(this).parent().addClass('on');
        tabContainers.filter(this.hash).addClass("on");
        return false;
    }).filter(':first').click();
});         