﻿function SetTopNav(pid)
{
    $(function()
    {
        $('#'+pid).attr('class','on');
    });
}

function SetSiteSearch(pblnOnEnter)
{
    var strKeyword=escape($('#txtSiteSearch').val());

    if (jQuery.trim(strKeyword).length==0) strKeyword='AsiaMalls';

    var strParams='?zoom_sort=0&zoom_xml=0&zoom_query='+strKeyword+'&zoom_per_page=10&zoom_and=0&zoom_cat%5B%5D=0';

    if (pblnOnEnter)
        window.location=$('#topSearchSumbit a').attr('href')+strParams;
    else
        $('#topSearchSumbit a').attr('href','search.aspx'+strParams);
}

function SetCorpNav(pid)
{
    $(function()
    {
        $('#'+pid).attr('class','on');
    });
}

function ToggleArchive(e)
{
    e = $('#' + e);  

    if (!e) return false;  

    /* Hides all month lists */
    $('.archive_month').addClass('hide');
    $('.archive_month').removeClass('show');

    /* Shows the selected month list */
    e.parent().next().addClass('show');
    e.parent().next().removeClass('hide');

    /* Removes the style of all years */
    $('.archive_month').prev().children().removeClass('selected');

    /* Adds style for the selected year */
    $(e).addClass('selected');

    /* Removes all br tags */
    $('.archive_month').each(function()
    {
        if ($(this).next().is('br'))
            $(this).next().remove();
    });

    /* Adds br tag for the selected year */
    $(e).parent().next().next().before('<br />');

    return false;
}

/*
function PreviewIMG(imgSrc,caption)
{
    $('.PreviewIMG1').attr('src',imgSrc);
    $('#NewsPageLeftInfoshow').html(caption);

    return false;
}

function ResetPreviewIMG(imgID,captionID)
{
    $('.PreviewIMG1').attr('src',$('#'+imgID).val());
    $('#NewsPageLeftInfoshow').html($('#' + captionID).val());

    return false;
}
*/

function ToggleCorpVideo(vid)
{
    var script='<object width="428" height="265">'+
                    '<param name="movie" value="http://www.youtube.com/v/'+vid+'&amp;hl=en_US&amp;fs=1"></param>'+
                    '<param name="allowFullScreen" value="true"></param>'+
                    '<param name="allowscriptaccess" value="always"></param>'+
                    '<embed src="http://www.youtube.com/v/'+vid+'&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="428" height="265"></embed>'+
                '</object>';

    $('#videoDetailShow').html(script);
    
    return false;
}

