
function FormValidation()
{
    var oForm = window.document.forms[0];
    return (ValidateForm(oForm));
}
function Display(piWidth, piHeight, psURL, psName, psProp)
{
    PopUp(piWidth, piHeight, psURL, psName, psProp);
}

function ptq(strMatch, strValue)
{
    var x = window.location.toString().split('&'), i, name, t;
    var value = "";
    for (i=0; i<x.length; i++)
    {
        t = x[i].split('=', 2);
        if(t[0].indexOf(strMatch) >= 0){ return t[1]; }
    }
    return "";
}

function LoadURL(strMatch, strVal)
{
    var i = 0;
    var strMain = window.location.toString();
    strMatch = strMatch.split(',');
    strVal = strVal.split(',');
    for( i = 0; i < strMatch.length; i++)
    {
        strMain = ptq(strMain, strMatch[i], strVal[i])
        if( trim1(strVal[i]) != "" ) { strMain += (strMain.indexOf('?') > 0 ? "&" : "?") + strMatch[i] + "=" + trim1(strVal[i]); }
    }
    window.location = strMain;
    return false;
}

function ptq(strMain, strMatch, strValue)
{
    var x = strMain.split('&'), i, name, t;
    strMain = '';
    var value = "";
    for (i=0; i<x.length; i++)
    {
        t = x[i].split('=', 2);
        if(t[0].indexOf(strMatch) < 0){ strMain += (strMain == "" ? x[i] : ( trim1(t[1]) != "" ? "&" + x[i] : "" ) ); }
    }
    return strMain;
}

function LoadData(obj, vlPg)
{
    var PopUp = false;
    if( vlPg == 1)
    {
        var strVal = GetChkVal("chkJobId");
        if( strVal == "" ) { showMessage("Please Select Atleast One job to Send to Your Buddy...!", "Job Search..."); }
        else if( strVal.indexOf(",") > 0 ) { showMessage("Please Select only One job at a time to Send to Your Buddy...!", "Job Search..."); }
        else { obj.href = "?jstb*qsJobId=" + strVal; PopUp = true; }
    }
    if( myLytebox && PopUp ) { myLytebox.start(obj, false, true); return false; }
    return false;
}

function LoadSave()
{
    var strVal = GetChkVal("chkJobId");
    if( strVal == "" ) { showMessage("Please select atleast one job to save...!", "Job Search..."); return false; }
    return true;
}

function LoadURLAdv(strDomain, strPageWoExt, strParam)
{
    var strVal = GetChkVal("chkJobId");
    strParam = ( strParam == null ? "qsJID" : strParam );
    if( strVal == "" ) { showMessage("Please select atleast one job to apply for it...!", "Job Search..."); }
    else { window.location = "http://" + strDomain + ".gobananas.in/" + strPageWoExt +".aspx?" + strParam + "=" + strVal; }
    return false;
}


function GetChkVal(objID)
{
        if (document.forms[0].elements[objID])
        {
            if( document.forms[0].elements[objID].length > 0 )
            {
                var rtVal = "";
                for( var i = 0; i < document.forms[0].elements[objID].length; i++)
                {
                    if( document.forms[0].elements[objID][i].checked ) { rtVal += ( rtVal == "" ? document.forms[0].elements["chkJobId"][i].value : "," + document.forms[0].elements[objID][i].value ); }
                }
                return rtVal
            }
            else { return ""; }
        }
        else { return ""; }
}
