﻿function OpenHelp() {
    var url = "http://64.118.93.12:89/Help/UserPreChat.asp";
    var features = "ocation=0,status=1,menubar=0,scrollbars=0,toolbar=0,resizable=1,width=520,height=370";
    window.open(url, "", features);
}
function GetCartGUID() {
    var name = 'AGMI_CART'
    var val = get_cookie(name);
    //alert(val)
    if (val == null) {
        return 'not_found';
    }
    return val;
}
function GetUGUID() {
    var name = 'AGMI_UGUID'
    var val = get_cookie(name);
    //alert(val)
    if (val == null) {
        return 'not_found';
    }
    //alert(val);
    return val;
}
function SaveCartCookie(value) {
    var expiray = 365 * 24 * 60 * 60 * 1000;
    var expires = new Date();
    expires.setTime(expires.getTime() + expiray);
    var cookieName = 'AGMI_CART'; // give the cookie a name
    //set_cookie(cookieName, 'JAMIL', expires);  
    set_cookie(cookieName, value, expires);
    //alert("cookie created");
    return "1";
}
function SaveUGUID(value) {
    var expiray = 365 * 24 * 60 * 60 * 1000;
    var expires = new Date();
    var cookieName = 'AGMI_UGUID';  
    
    expires.setTime(expires.getTime() + expiray);
    set_cookie(cookieName, value, expires);
    return "1";
}
function GetRGUID() {
    //alert(document.getElementById("hfRGUID"));
    //alert(document.getElementById("hfRGUID").value);
    return document.getElementById("hfRGUID").value;
}
function GetDDPSGUID() {
    //alert(document.getElementById("hfDDPSGUID"));
    //alert(document.getElementById("hfDDPSGUID").value);
    return document.getElementById("hfDDPSGUID").value;
}
function ShowGUID(val) {
    //alert(val);
}
function OpenDownloadView(dsguid, uguid, clientid, download_of, format) {
    //alert(dsguid);
    if (dsguid == "") {
        alert("Could not start Downloading");
        return "-1";
    }

    //window.open("DownloadView.aspx?DSGUID="+dsguid+"&UGUID="+uguid+"&ClientID="+clientid+"&DownloadOf="+download_of,'','width=625,location=0,status=1,menubar=0,scrollbars=0,toolbar=0,resizable=0', '');
    window.frames["downloadManager"].location.href = "DownloadView.aspx?DSGUID=" + dsguid + "&UGUID=" + uguid + "&ClientID=" + clientid + "&DownloadOf=" + download_of + "&Format=" + format;
    return "1";
}
function GetSearchString() {
    return document.getElementById('hfSearchString').value;
}
function DownloadMediaItem(guid, uguid, clientid, format) {
    //alert("UGUID: " + uguid);
    //alert(guid);
    //alert(uguid);
    //window.open("Download.aspx?DD=TRUE&MIGUID=" + guid + "&UGUID=" + uguid + "&ClientID=" + clientid,"","height=200;width=300;resizable=1;location=1,status=1,scrollbars=1");
    //window.open("DownloadMediaItem.aspx?DD=TRUE&MIGUID=" + guid + "&UGUID=" + uguid + "&ClientID=" + clientid,"","height=50;width=50;resizable=0;location=0,status=0,scrollbars=0");
    window.frames["downloadManager"].location.href = "DownloadMediaItem.aspx?DD=TRUE&MIGUID=" + guid + "&UGUID=" + uguid + "&ClientID=" + clientid + "&Format=" + format;
}
var count = 0;
function DownloadSession(DSGUID, isZipped) {
    window.frames["downloadManager" + count].location.href = "DownloadSession.aspx?DSGUID=" + DSGUID + "&isZipped=" + isZipped + "&if=" + count;
    count++;
    if (count > 50) {
        count = 0;
    }    
}
