﻿function switchValidata(id) {
    var $validata = $(id);
    var url = $validata.attr('src').split('?');
    $validata.attr('src', url[0] + '?' + new Date().getTime());
}

function SetCwinHeight(obj) {
    var cwin = obj;
    try {
        if (document.getElementById) {
            if (cwin && !window.opera) {
                if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight)
                    cwin.height = cwin.contentDocument.body.offsetHeight + 20;
                else if (cwin.Document && cwin.Document.body.scrollHeight)
                    cwin.height = cwin.Document.body.scrollHeight + 20;
            }
            if (window.opera || Sys.chrome) {
                if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight)
                    cwin.height = cwin.contentDocument.body.offsetHeight + 60;
                else if (cwin.Document && cwin.Document.body.scrollHeight)
                    cwin.height = cwin.Document.body.scrollHeight + 60;
            }
        }
    } catch (e) { }
}

//框架Iframe链接切换
var oldObj;
function onMain(obj, page) {
    var currentObj = $(obj).parent();
    if (oldObj) {
        if (oldObj[0].id.length > 0)
            oldObj.removeClass(oldObj[0].id);
        else
            oldObj.removeClass("Current");
    }

    if (currentObj[0].id.length > 0)
        currentObj.addClass(currentObj[0].id);
    else
        currentObj.addClass("Current");

    oldObj = currentObj;

    if (page == 'Pay')
        $("#main1").attr("src", "http://pay.ysplay.com/OnlinePayment/" + page + ".aspx");
    else
        $("#main1").attr("src", "../../" + page + ".aspx");

}

function loadNews(expr, pIndex, pSize) {
    var client = { Call: "NewsListByPassport", pIndex: pIndex, pSize: pSize };
    $.post('AsynNews.ashx?' + new Date(), client,
            function(data) {
                $(expr).html(data);
            });
    return false;
}