﻿/**
* File Name : main.js
* Purpose : This File have comman javascript method for whole project.
* Description: It contain the whole comman javascript method which are using
*              in jagran e-paper project.
* Dependencies: Client server
* Date of Creation: 16-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/


/**
* Function Name : borderit
* Purpose : This Function is used for create map in single page mode 
* Dependencies: Client server
* Date of Creation: 19-March-2010
* Created By : 4C Plus Int co.ory
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
var al_l = "";
var at_t = "";
var ar_r = "";
var ab_b = "";
var hit_file = "";
function returnMozillaMap() {
    //    document.getElementById('oFilterDIV1').style.visibility="hidden";
    //    return true;
}
var mozCord = 0;
var mozCord_x;

function borderit(which, color, boxid, al, at, ar, ab, edate, parentid, pageno, editioncode) {
    document.getElementById("txtbox").value = boxid;
    document.getElementById("txtparent").value = parentid;
    document.getElementById("txtpagenew").value = pageno;
    document.getElementById("txtedt").value = editioncode;
}

/**
* Function Name : borderit1
* Purpose : This Function is used for create map in double page mode 
* Date of Creation: 19-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function borderit1(which, color, boxid, al, at, ar, ab, edate, parentid, pageno, editioncode) {

}

/**
* Function Name : setbottombars
* Purpose : This Function is used for check the page mode
* Date of Creation: 19-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function setbottombars() {
    if (document.getElementById('txtturn').value == "turn_page") {
        alert('you are viewing single page view.')
        return false
    }
}

/**
* Function Name : setbottombar
* Purpose : This Function is used for check the page mode,Last page,First Page
* Date of Creation: 19-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function setbottombar() {
    if (document.getElementById('txtturn').value == "page_turn") {
        alert('you are viewing double page view.')
        return false
    }
    if (document.getElementById('txtpageno').value == document.getElementById('txtfirstpage').value) {
        alert('you are viewing the first page.')
        return false
    }
    if (document.getElementById('txtpageno').value == document.getElementById('txtmaxpageno').value) {
        alert('you are viewing the last page.')
        return false
    }
}

/**
* Function Name : spage
* Purpose : This Function is used move the next page
* Date of Creation: 19-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function spage(pgno, ixml) {
    //alert(pgno);
    //alert(ixml);
    document.frmepaper.txtpageno.value = pgno;
    document.frmepaper.txtparentid.value = ixml;
//eddate=2011-6-17&edcode=4
//    document.getElementById("txtedition").value = txtedition;
//    document.getElementById("txtdate").value = txtdate;
//    alert(txtedition);
//    alert(txtdate);
  //window.location.href = "" + epaperurl + "?eddate=2011-6-9&edcode=2";

  document.frmepaper.submit();
    
    //window.location.href = "epapermain.aspx";
}

/**
* Function Name : show_pop
* Purpose : This Function is call include function
* Date of Creation: 19-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function show_pop(id, winName, divn, edate, pagno, edcode) {
    
    include('contentxml', 'getcontent.aspx?parentid=' + id + '&boxid=' + winName, id, winName, edate, pagno, edcode);
    return false;
}

var popUpWin = 0;

/**
* Function Name : include
* Purpose : This Function open story page
* Date of Creation: 19-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function include(lyr, url, id, winName, edate, pagno, edcode) {
    var id = id;
    var boxid = winName;
    //	if(popUpWin)
    //    {
    //        if(!popUpWin.closed) popUpWin.close();
    //    }
    //	popUpWin = open('story.aspx?id='+ id + '&boxid=' + boxid,'popUpWin','toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=50,left=50,width=800,height=600,titlebar=no')
    var EDname = document.getElementById('txteditionname').value;
    EDname = EDname.replace(" ", "-");
    edate = edate.replace("/", "-");
    edate = edate.replace("/", "-");
 
    var GetDT = edate.split("-");
    var DD = GetDT[2];
    var MM = GetDT[1];
    var YY = GetDT[0];
   
    if (MM == "01") { MM = "jan"; }
    if (MM == "02") { MM = "feb"; }
    if (MM == "03") { MM = "mar"; }
    if (MM == "04") { MM = "apr"; }
    if (MM == "05") { MM = "may"; }
    if (MM == "06") { MM = "jun"; }
    if (MM == "07") { MM = "jul"; }
    if (MM == "08") { MM = "aug"; }
    if (MM == "09") { MM = "sep"; }
    if (MM == "10") { MM = "oct"; }
    if (MM == "11") { MM = "nov"; }
    if (MM == "12") { MM = "dec"; }
    var FDate = DD + "-" + MM + "-" + YY;
    
    var url= "" + storyurl + "?id=" + id + "&boxid=" + boxid + "&ed_date=" + edate + "&ed_code=" + edcode + "&ed_page=" + pagno;
    
   // var url = "ePaperArticle/" + FDate + "-edition-" + EDname + "-page_" + pagno + "-" + id + "-" + boxid + "-" + edcode + ".html";
      
    document.getElementById('dvmainContent').style.zIndex = 2
    document.getElementById('dvmainContent').style.display = "block";
    document.getElementById('ifrmContent').style.display = "block";
    parent.document.getElementById('idivSearch').style.display = "none";
    parent.document.getElementById('ifrmsearch').style.display = "none";
   // alert(document.getElementById('ifrmContent').src = url);
    document.getElementById('ifrmContent').src = url;   
    closeHeadingPopup();
    return false;
}

/**
* Function Name : closeContentDiv
* Purpose : This Function close story page
* Date of Creation: 19-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function closeContentDiv() {
    var i = 0;
    var j = parseInt(parent.document.getElementById('txtmaxpageno').value);
    for (i = 0; i < j; i++) {
        if (parent.document.getElementById('divpagehead_' + i) != null) {
            parent.document.getElementById('divpagehead_' + i).className = 'deselectTableContent';
            parent.document.getElementById('spanhead_' + i).style.display = 'none';
        }
    }
    document.getElementById('storyText').innerHTML = "";
    document.getElementById('storyHeading').innerHTML = "";
    document.getElementById('storyText').innerHTML = "<center><img src='facefiles/loading.gif' style='text-align:center;' /></center>";
    document.getElementById('storyImage').innerHTML = "<center><img src='facefiles/loading.gif' style='text-align:center;' /></center>";
    parent.document.getElementById('ifrmContent').style.display = "none";
}

/**
* Function Name : l_page_turn(),flip_l_page_turn()
* Purpose : Check First Page and open previous page
* Date of Creation: 19-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function l_page_turn() {
    var pg = document.getElementById("txtpageno").value;
    if (document.getElementById('txtpageno').value == document.getElementById('txtmaxpageno').value) {
        alert('you are on last page.')
        return false;
    }
}

function flip_l_page_turn() {
    var pg = document.getElementById("txtpageno").value;
    if (document.getElementById('txtpageno').value == document.getElementById('txtmaxpageno').value) {
        alert('you are on last page.')
        return false;
    }
    else {
        document.getElementById('txtpageno').value = parseInt(document.getElementById('txtpageno').value) + parseInt(1);
        document.frmepaper.submit();
    }
}

/**
* Function Name : R_page_turn(),flip_R_page_turn()
* Purpose : Check Last Page and open next page
* Date of Creation: 19-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function flip_R_page_turn() {
    var pg = document.getElementById("txtpageno").value;
    if (document.getElementById('txtpageno').value == document.getElementById('txtfirstpage').value) {
        alert('you are on first page.');
        return false;
    }
    else {
        document.getElementById('txtpageno').value = parseInt(document.getElementById('txtpageno').value) - parseInt(1);
        document.frmepaper.submit();
    }
}

function R_page_turn() {
    var pg = document.getElementById("txtpageno").value;
    if (document.getElementById('txtpageno').value == document.getElementById('txtfirstpage').value) {
        alert('you are on first page.');
        return false;
    }

}

/**
* Function Name : Page_Thumbnail
* Purpose : Show the pages thumbnails in right side.
* Date of Creation: 22-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function Page_Thumbnail() {
    if (document.getElementById('txtthumbnail').value != "thumbnail") {
        document.getElementById('txtthumbnail').value = "thumbnail";
        document.frmepaper.submit();
    }
}

/**
* Function Name : Page_List
* Purpose : Show the list of pages in right side.
* Date of Creation: 22-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function Page_List() {
    if (document.getElementById('txtthumbnail').value != "pagelist") {
        document.getElementById('txtthumbnail').value = "pagelist";
        document.frmepaper.submit();
    }
}

/**
* Function Name : spagesup
* Purpose : This function is use to change the edition.
* Date of Creation: 22-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function spagesup(ed, pgno, ixml) {
    document.getElementById('txtedition').value = ed;
    document.getElementById('txtpageno').value = pgno;
    document.getElementById('txtparentid').value = ixml;
    document.frmepaper.submit();
}

/**
* Function Name : setpage
* Purpose : This function is use to open clicked thumbnail page.
* Date of Creation: 22-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function setpage(txtedition, txtdate, pageno) {
    document.getElementById("txtedition").value = txtedition;
    document.getElementById("txtdate").value = txtdate;
    document.getElementById("txtpageno").value = pageno;
    document.getElementById("txtpg").value = pageno;
    document.frmepaper.submit();
}

/**
* Function Name : pageView
* Purpose : This function is use to show story in text, image format.
* Date of Creation: 23-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function pageView(changeText) {
    document.getElementById('txtChangeOption').value = changeText;
    document.storyform.submit();
}



/**
* Function Name : saveStroy
* Purpose : This function is use to save pdf.
* Date of Creation: 23-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function saveStroy() {
    var pdfDate = document.getElementById('txtpdfdate').value;
    var url = document.getElementById('txtWebUrl').value;
    var pgno = document.getElementById('txtpagenumber').value;
    var completeUrl = url + pdfDate + "/" + pdfDate + "-md-hr-" + pgno + ".pdf"
    window.open(completeUrl);

}

/**
* Function Name : emailStroy
* Purpose : This function is use to email story.
* Date of Creation: 23-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function emailStroy() {
    var boxid = document.getElementById("txtboxid").value;
    var parentid = document.getElementById("txtparentid").value;
    var x = window.open("email.aspx?id=" + parentid + "&boxid=" + boxid, "", "toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=120,left=350,width=565,height=320,titlebar=no");

}

/**
* Function Name : facebookStroy
* Purpose : This function is use to send story on facebookStroy.
* Date of Creation: 23-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function facebookStroy() {
    var url;
    document.getElementById('txtboxid').value;
    document.getElementById('txtparentid').value;
    window.open("http://www.facebook.com");
}


/**
* Function Name : twitterStroy
* Purpose : This function is use send story on twitter
* Date of Creation: 23-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function twitterStroy() {
    var url;
    document.getElementById('txtboxid').value;
    document.getElementById('txtparentid').value;
    window.open("http://twitter.com/");
}


/**
* Function Name : openbigwin
* Purpose : This function is use open image
* Date of Creation: 24-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function openbigwin(url1) {
    var x = window.open("displayimmage.htm", "", "toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=150,left=350,width=600,height=560,titlebar=yes");
    if (x.document.images.length == 0) {
        x.document.write("<table id='danish'><tr><td><img src='" + url1 + "'></td></tr>");
        x.document.write("<tr><td align='right'><br><br><font face='arial' style='CURSOR:hand;' size=1 onclick='window.close()'>Close</font>&nbsp;&nbsp;&nbsp;</td></tr></table>");
    }
}

/**
* Function Name : zoomoutimage
* Purpose : This function is use to zoom page
* Date of Creation: 24-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function zoomoutimage_old() {
    if (document.getElementById("txtpageno").value != document.getElementById("txtfirstpage").value && document.getElementById("txtpageno").value != document.getElementById("txtmaxpageno").value) {
        if (document.getElementById('txtturn').value == 'page_turn') {
            alert('Zoom in will work in single page mode.')
            return;
        }
    }
    if (document.getElementById('imgpage').src.indexOf('ll.jpg') > 0) {
        alert('You cannot Increase the page further.');
        return;
    }
    if (document.all) {
        // IE version
        try {
            var xml = new ActiveXObject("Microsoft.XMLHTTP");
            xml.Open("GET", "xmlform.aspx?page=2&imgpage=" + document.getElementById("imgpage").src.replace("s.jpg", ".jpg").replace("l.jpg", "ll.jpg").replace("lll.jpg", "ll.jpg") + "&txtdate=" + document.getElementById("txtdate").value + "&txtedition=" + document.getElementById("txtedition").value, false);
            xml.Send()
            var rp = xml.responseText;
            document.getElementById('Label1').innerHTML = rp;
        }
        catch (e) {
            var xml = new ActiveXObject("MSXML2.XMLHTTP.4.0");
            xml.Open("GET", "xmlform.aspx?page=2&imgpage=" + document.getElementById("imgpage").src.replace("s.jpg", ".jpg").replace("l.jpg", "ll.jpg").replace("lll.jpg", "ll.jpg") + "&txtdate=" + document.getElementById("txtdate").value + "&txtedition=" + document.getElementById("txtedition").value, false);
            xml.Send()
            var rp1 = xml.responseText;
            document.getElementById('Label1').value = rp1;
        }
    }
    else {

        var xml = new XMLHttpRequest();
        xml.open("GET", "xmlform.aspx?page=2&imgpage=" + document.getElementById("imgpage").src.replace("s.jpg", ".jpg").replace("l.jpg", "ll.jpg").replace("lll.jpg", "ll.jpg") + "&txtdate=" + document.getElementById("txtdate").value + "&txtedition=" + document.getElementById("txtedition").value, false);
        xml.send(null);
        var rp2 = xml.responseText;
        document.getElementById('Label1').value = rp2;

    }
    alert(document.getElementById('Label1').value)
    document.getElementById('imgpage').width = 516;
    document.getElementById('imgpage').height = 779;
    document.getElementById('imgpage').useMap = "";
    document.getElementById('imgpage').useMap = "#Mapll";
    alert(document.getElementById('imgpage').useMap);
    document.getElementById('imgpage').src = document.getElementById('imgpage').src.replace('s.jpg', 'l.jpg').replace('.jpg', 'l.jpg').replace('ll.jpg', 'l.jpg').replace('l.jpg', 'll.jpg').replace("lll.jpg", "ll.jpg");
    return;
}

/**
* Function Name : zoompageimage
* Purpose : This function is use to zoom in page
* Date of Creation: 24-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function zoompageimage() {

    if (document.getElementById("txtpageno").value != document.getElementById("txtfirstpage").value && document.getElementById("txtpageno").value != document.getElementById("txtmaxpageno").value) {
        if (document.getElementById('txtturn').value == 'page_turn') {
            alert('Zoom out will work in single page mode.')
            return false;
        }
    }

    if (document.getElementById('imgpage').src.indexOf('ll.jpg') < 0) {
        if (document.getElementById('imgpage').src.indexOf('l.jpg') > 0) {
            alert('You cannot Decrease the page further.');
            return;
        }
    }

    if (document.all) {
        // IE version
        try {
            var xml = new ActiveXObject("Microsoft.XMLHTTP");
            xml.Open("GET", "xmlform.aspx?page=4&imgpage=" + document.getElementById("imgpage").src.replace("s.jpg", ".jpg").replace("l.jpg", ".jpg") + "&txtdate=" + document.getElementById("txtdate").value + "&txtedition=" + document.getElementById("txtedition").value, false);
            xml.Send()
            var rp = xml.responseText;
            document.getElementById('Label1').innerHTML = rp;
        }
        catch (e) {
            var xml = new ActiveXObject("MSXML2.XMLHTTP.4.0");
            xml.Open("GET", "xmlform.aspx?page=4&imgpage=" + document.getElementById("").src.replace("s.jpg", ".jpg").replace("l.jpg", ".jpg") + "&txtdate=" + document.getElementById("txtdate").value + "&txtedition=" + document.getElementById("txtedition").value, false);
            xml.Send()
            var rp1 = xml.responseText;
            document.getElementById('Label1').value = rp1;
        }
    }
    else {
        var xml = new XMLHttpRequest();
        xml.open("GET", "xmlform.aspx?page=4&imgpage=" + document.getElementById("imgpage").src.replace("s.jpg", ".jpg").replace("l.jpg", ".jpg") + "&txtdate=" + document.getElementById("txtdate").value + "&txtedition=" + document.getElementById("txtedition").value, false);
        xml.send(null);
        var rp2 = xml.responseText;
        document.getElementById('Label1').value = rp2;
    }
    document.getElementById('imgpage').width = 360;
    document.getElementById('imgpage').height = 543;
    document.getElementById('imgpage').useMap = "";
    document.getElementById('imgpage').useMap = "#Mapl";
    document.getElementById('imgpage').src = document.getElementById('imgpage').src.replace('s.jpg', 'l.jpg').replace('.jpg', 'l.jpg').replace('ll.jpg', 'l.jpg');
    document.getElementById('imgpage').src = document.getElementById('imgpage').src.replace('ll.jpg', 'l.jpg');
    return;
}

/**
* Function Name : archives
* Purpose : This function is use open archive window
* Date of Creation: 24-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function archives() {
    window.open("archives.aspx", 'Archives', 'left=100,top=100,height=350,width=458,scrollbars=no,statusbar=no,toolbars=no,resizable=no')
}


/**
* Function Name : checkArchive
* Purpose : This function is use open archive window
* Date of Creation: 24-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
var edtcen = "";
var b;
var bdat;

function checkArchive() {
    b = document.getElementById('Dropmonth').value + "/" + document.getElementById('Dropday').value + "/" + document.getElementById('Dropyear').value;
    var edName = document.getElementById("txteditionname").value;
    
    epapermain.validatedate(edtcen, b, edName, callback_validatedate)
    return false;
}

function callback_validatedate(response) {
    alert(response);
    var ds = response.value;
    bdat = ds.split("-");
    if (bdat[0] == "False") {
        alert("Sorry!This date archive is not Available!")
    }
    else {
        subdate(bdat[1], b);
    }
}

function openwin(url) {
    window.open(url);
}

function dispdate(date1) {
    document.getElementById('txtdate').value = date1;
    document.Form1.submit();
}
function subdate(a, b) {
    try {
        if (typeof (window.opener) != "undefined") {
            var x_win = window.self;
            while (x_win != "undefined") {
                x_win = x_win.opener;
                if (typeof (x_win.opener) == "undefined") {
                    var h = "y";
                    var s;
                    s = "" + epaperurl + "?queryed=" + a + "&getda=h&eddate=" + b;
                    window.open(s);
                    window.close()
                    break;
                }
            }
        }
        else {
            var z;
            z = "" + epaperurl + "?queryed=" + a + "&getda=h&eddate=" + b;
            window.open(z);
        }
    }
    catch (e) {
        window.open("/");
    }
}

/**
* Function Name : validateuser
* Purpose : This function is use validate the user
* Date of Creation: 24-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function validateuser() {

    if (document.frmnewuser.txtnm.value == "") {
        alert("Enter Name");
        document.frmnewuser.txtnm.focus();
        return false;
    }

    /*if(document.frmnewuser.txtadd.value=="")
    {
    alert("Enter Address");
    document.frmnewuser.txtadd.focus();
    return false;
    }  
    
    if(document.frmnewuser.drpcntry.value=="select")
    {
    alert("Select Country");
    document.frmnewuser.drpcntry.focus();
    return false;
    } 
    */
    if (document.frmnewuser.txtml.value == "") {
        alert("Enter Your E-mail id");
        document.frmnewuser.txtml.focus();
        return false;
    }

    if (!isEmail(document.frmnewuser.txtml.value)) {
        alert("Please Enter valid Email Address");
        document.frmnewuser.txtml.focus();
        return false;
    }

    if (document.frmnewuser.txtpass.value == "") {
        alert("Enter Password");
        document.frmnewuser.txtpass.focus();
        return false;
    }

    if (document.frmnewuser.txtpass.value.length < 6) {
        alert("Password sholud be greater than 6 characters");
        document.frmnewuser.txtpass.focus();
        return false;
    }

    if (document.frmnewuser.txtconfirm.value == "") {
        alert("Confirm Password");
        document.frmnewuser.txtconfirm.focus();
        return false;
    }

    if (document.frmnewuser.txtpass.value != document.frmnewuser.txtconfirm.value) {
        alert("Confirm Password");
        document.frmnewuser.txtconfirm.focus();
        return false;
    }


    /*    if(document.frmnewuser.txtcity.value=="")
    {
    alert("Enter City");
    document.frmnewuser.txtcity.focus();
    return false;
    }

    if(document.frmnewuser.txtzip.value=="")
    {
    alert("Enter Postal Code");
    document.frmnewuser.txtzip.focus();
    return false;
    }
    
    if(document.frmnewuser.txtzip.value.length>6)
    {
    alert("Zip code cann't be greater than 5 digits");
    document.frmnewuser.txtzip.focus();
    return false;
    }
    
    if(document.frmnewuser.txtstate.value=="")
    {
    alert("Enter State");
    document.frmnewuser.txtstate.focus();
    return false;
    }
    */
}

/**
* Function Name : isEmail
* Purpose : This function is used to chaeck valid email id
* Date of Creation: 24-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function isEmail(email) {
    if (document.frmnewuser.txtml.value.indexOf("@") != "-1" && document.frmnewuser.txtml.value.indexOf(".") != "-1") {
        return true;
    }
    else {
        return false;
    }
}

/**
* Function Name : ValidateNumeric
* Purpose : This function is used to check numeric value
* Date of Creation: 24-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function ValidateNumeric(e) {
    var keyCode = "";
    if (navigator.appName.indexOf("Microsoft") != -1)//for ie
    {
        keyCode = e.keyCode;
    }
    else {
        keyCode = e.which;
    }

    if ((keyCode > 57 || keyCode < 48) && (keyCode != 8))
        return false;
}

/**
* Function Name : CheckCharacter
* Purpose : This function is used to check character value
* Date of Creation: 24-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function CheckCharacter(e) {
    var keyCode = "";
    if (navigator.appName.indexOf("Microsoft") != -1)//for ie
    {
        keyCode = e.keyCode;
    }
    else {
        keyCode = e.which;
    }
    if ((keyCode <= 57 || keyCode < 48) && (keyCode != 8))
        return false;
}

/**
* Function Name : checkLoginUser
* Purpose : This function is used to check login user value
* Date of Creation: 25-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function checkLoginUser() {
    if (document.getElementById('txtusername').value == "") {
        alert("Please enter your email id.");
        document.frmlogin.txtusername.focus();
        return false
    }

    if (!isEmail_loginto(document.frmlogin.txtusername.value)) {
        document.frmlogin.txtusername.focus();
        return false;
    }

    if (document.getElementById('txtpassword').value == "") {
        alert("Please enter password.");
        document.frmlogin.txtpassword.focus();
        return false;
    }

}


/**
* Function Name : isEmail_loginto
* Purpose : This function is used to check vaild email id
* Date of Creation: 26-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function isEmail_loginto(email) {
    if (document.frmlogin.txtusername.value.indexOf("@") != "-1" && document.frmlogin.txtusername.value.indexOf(".") != "-1") {
        return true;
    }
    else {
        alert("Please enter valid email id")
        return false;
    }
}


/**
* Function Name : checkSpace
* Purpose : This function is used to check white space
* Date of Creation: 25-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function checkSpace(e) {

    var keyCode = "";
    if (navigator.appName.indexOf("Microsoft") != -1)//for ie
    {
        keyCode = e.keyCode;
    }
    else {
        keyCode = e.which;
    }
    if (keyCode == 32)
        return false;
}


/**
* Function Name : isEmailfrom
* Purpose : This function is used to check vaild email id
* Date of Creation: 26-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function isEmailfrom(email) {
    if (document.frmemail.txtfrom.value.indexOf("@") != "-1" && document.frmemail.txtfrom.value.indexOf(".") != "-1") {
        return true;
    }
    else {
        return false;
    }
}

/**
* Function Name : checkForm
* Purpose : This function is used to validate form
* Date of Creation: 26-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function checkForm() {
    if (document.frmemail.txtto.value == "") {
        alert("Please enter the recipient's mail id.")
        document.frmemail.txtto.focus();
        return false;
    }
    if (!isEmail_to(document.frmemail.txtto.value)) {
        document.frmemail.txtto.focus();
        return false;
    }
    if (document.frmemail.txtfrom.value == "") {
        alert("Please enter your mail id.")
        document.frmemail.txtfrom.focus();
        return false;
    }

    if (!isEmailfrom(document.frmemail.txtfrom.value)) {
        alert("Please Enter valid Email Address");
        document.frmemail.txtfrom.focus();
        return false;
    }

    return true;
}

/**
* Function Name : isEmailfrom
* Purpose : This function is used to check vaild email id
* Date of Creation: 26-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function isEmail_to(email) {
    if (document.frmemail.txtto.value.indexOf("@") != "-1" && document.frmemail.txtto.value.indexOf(".") != "-1") {
        return true;
    }
    else {
        alert("Please enter valid email id")
        return false;
    }
}

/**
* Function Name : checkforgotBox
* Purpose : This function is used to check empty text box
* Date of Creation: 26-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function checkforgotBox() {

    if (document.getElementById('txtto').value == "") {
        alert("Please enter valid email id");
        return false;
    }

    if (!isEmail_to(document.frmemail.txtto.value)) {
        document.frmemail.txtto.focus();
        return false;
    }
}

/**
* Function Name : checkFeedBackForm
* Purpose : This function is used to check empty text box
* Date of Creation: 26-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function checkFeedBackForm() {
    if (document.getElementById('txtnm').value == "") {
        alert("Please enter name");
        document.getElementById('txtnm').focus();
        return false;
    }

    if (document.getElementById('txtto').value == "") {
        alert("Please enter valid email id");
        document.getElementById('txtto').focus();
        return false;

    }

    if (!isEmail_to(document.getElementById('txtto').value)) {
        document.getElementById('txtto').focus();
        return false;

    }

    if (document.getElementById('txtadd').value == "") {
        alert("Please enter Your comment");
        document.getElementById('txtadd').focus();
        return false;
    }

    if (!isEmail_to(document.frmemail.txtto.value)) {
        document.frmemail.txtto.focus();
        return false;
    }
}

/**
* Function Name : chnageImageView
* Purpose : This function is used to view the
* image view of print story
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function changeImageView() {
    var boxid = document.getElementById("txtboxid").value;
    var id = document.getElementById("txtparentid").value;
    var edcode = document.getElementById("txteditioncode").value;
    var edate = document.getElementById("txtpdfdate").value;
    document.getElementById("showFlaStory").src = "flastoryzoom.aspx?id=" + id + "&boxid=" + boxid + "&ed_date=" + edate + "&ed_code=" + edcode;
    document.getElementById("tview").src = "images/textview.gif";
    document.getElementById("iview").src = "images/photo-color.gif";
    document.getElementById("storyContent").style.display = "none";
    document.getElementById("imageContent").style.display = "block";
    document.getElementById("imageViewMenu").style.display = "block";
}

/**
* Function Name : changeTextView
* Purpose : This function is used to view the
* Text view of print story
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function changeTextView() {
    document.getElementById("tview").src = "images/textview-color.gif";
    document.getElementById("iview").src = "images/photo.gif";
    document.getElementById("storyContent").style.display = "block";
    document.getElementById("imageContent").style.display = "none";
    document.getElementById("imageViewMenu").style.display = "none";
}


/**
* Function Name : inserRateingStroy
* Purpose : This function is used to insert
* rating of print story
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function inserRateingStroy(rateValue) {
    var boxid = document.getElementById("txtboxid").value;
    var parentid = document.getElementById("txtparentid").value;
    story.insertRating(boxid, parentid, rateValue, callback_rating)
    return false;
}

function callback_rating(response) {
    var ds = response.value;
    var bdat = ds.split("-");
    if (parseInt(bdat[1]) == parseInt(0)) {
        document.getElementById("str1").src = "images/Gry-star.gif";
        document.getElementById("str2").src = "images/Gry-star.gif";
        document.getElementById("str3").src = "images/Gry-star.gif";
        document.getElementById("str4").src = "images/Gry-star.gif";
        document.getElementById("str5").src = "images/Gry-star.gif";

        document.getElementById("str6").src = "images/Gry-star.gif";
        document.getElementById("str7").src = "images/Gry-star.gif";
        document.getElementById("str8").src = "images/Gry-star.gif";
        document.getElementById("str9").src = "images/Gry-star.gif";
        document.getElementById("str10").src = "images/Gry-star.gif";
    }
    else if (parseInt(bdat[1]) == parseInt(1)) {
        document.getElementById("str1").src = "images/Y-star.gif";
        document.getElementById("str2").src = "images/Gry-star.gif";
        document.getElementById("str3").src = "images/Gry-star.gif";
        document.getElementById("str4").src = "images/Gry-star.gif";
        document.getElementById("str5").src = "images/Gry-star.gif";

        document.getElementById("str6").src = "images/Y-star.gif";
        document.getElementById("str7").src = "images/Gry-star.gif";
        document.getElementById("str8").src = "images/Gry-star.gif";
        document.getElementById("str9").src = "images/Gry-star.gif";
        document.getElementById("str10").src = "images/Gry-star.gif";
    }
    else if (parseInt(bdat[1]) == parseInt(2)) {
        document.getElementById("str1").src = "images/Y-star.gif";
        document.getElementById("str2").src = "images/Y-star.gif";
        document.getElementById("str3").src = "images/Gry-star.gif";
        document.getElementById("str4").src = "images/Gry-star.gif";
        document.getElementById("str5").src = "images/Gry-star.gif";

        document.getElementById("str6").src = "images/Y-star.gif";
        document.getElementById("str7").src = "images/Y-star.gif";
        document.getElementById("str8").src = "images/Gry-star.gif";
        document.getElementById("str9").src = "images/Gry-star.gif";
        document.getElementById("str10").src = "images/Gry-star.gif";
    }
    else if (parseInt(bdat[1]) == parseInt(3)) {
        document.getElementById("str1").src = "images/Y-star.gif";
        document.getElementById("str2").src = "images/Y-star.gif";
        document.getElementById("str3").src = "images/Y-star.gif";
        document.getElementById("str4").src = "images/Gry-star.gif";
        document.getElementById("str5").src = "images/Gry-star.gif";

        document.getElementById("str6").src = "images/Y-star.gif";
        document.getElementById("str7").src = "images/Y-star.gif";
        document.getElementById("str8").src = "images/Y-star.gif";
        document.getElementById("str9").src = "images/Gry-star.gif";
        document.getElementById("str10").src = "images/Gry-star.gif";

    }
    else if (parseInt(bdat[1]) == parseInt(4)) {
        document.getElementById("str1").src = "images/Y-star.gif";
        document.getElementById("str2").src = "images/Y-star.gif";
        document.getElementById("str3").src = "images/Y-star.gif";
        document.getElementById("str4").src = "images/Y-star.gif";
        document.getElementById("str5").src = "images/Gry-star.gif";

        document.getElementById("str6").src = "images/Y-star.gif";
        document.getElementById("str7").src = "images/Y-star.gif";
        document.getElementById("str8").src = "images/Y-star.gif";
        document.getElementById("str9").src = "images/Y-star.gif";
        document.getElementById("str10").src = "images/Gry-star.gif";
    }
    else {
        document.getElementById("str1").src = "images/Y-star.gif";
        document.getElementById("str2").src = "images/Y-star.gif";
        document.getElementById("str3").src = "images/Y-star.gif";
        document.getElementById("str4").src = "images/Y-star.gif";
        document.getElementById("str5").src = "images/Y-star.gif";

        document.getElementById("str6").src = "images/Y-star.gif";
        document.getElementById("str7").src = "images/Y-star.gif";
        document.getElementById("str8").src = "images/Y-star.gif";
        document.getElementById("str9").src = "images/Y-star.gif";
        document.getElementById("str10").src = "images/Y-star.gif";

    }
    alert("Thanks for rating!!!");
    if (parseInt(bdat[0]) == 0) {
        document.getElementById("str1").src = "images/Gry-star.gif";
        document.getElementById("str2").src = "images/Gry-star.gif";
        document.getElementById("str3").src = "images/Gry-star.gif";
        document.getElementById("str4").src = "images/Gry-star.gif";
        document.getElementById("str5").src = "images/Gry-star.gif";

        document.getElementById("str6").src = "images/Gry-star.gif";
        document.getElementById("str7").src = "images/Gry-star.gif";
        document.getElementById("str8").src = "images/Gry-star.gif";
        document.getElementById("str9").src = "images/Gry-star.gif";
        document.getElementById("str10").src = "images/Gry-star.gif";
    }
    else if (parseInt(bdat[0]) == parseInt(1)) {
        document.getElementById("str1").src = "images/Y-star.gif";
        document.getElementById("str2").src = "images/Gry-star.gif";
        document.getElementById("str3").src = "images/Gry-star.gif";
        document.getElementById("str4").src = "images/Gry-star.gif";
        document.getElementById("str5").src = "images/Gry-star.gif";

        document.getElementById("str6").src = "images/Y-star.gif";
        document.getElementById("str7").src = "images/Gry-star.gif";
        document.getElementById("str8").src = "images/Gry-star.gif";
        document.getElementById("str9").src = "images/Gry-star.gif";
        document.getElementById("str10").src = "images/Gry-star.gif";
    }
    else if (parseInt(bdat[0]) == parseInt(2)) {
        document.getElementById("str1").src = "images/Y-star.gif";
        document.getElementById("str2").src = "images/Y-star.gif";
        document.getElementById("str3").src = "images/Gry-star.gif";
        document.getElementById("str4").src = "images/Gry-star.gif";
        document.getElementById("str5").src = "images/Gry-star.gif";

        document.getElementById("str6").src = "images/Y-star.gif";
        document.getElementById("str7").src = "images/Y-star.gif";
        document.getElementById("str8").src = "images/Gry-star.gif";
        document.getElementById("str9").src = "images/Gry-star.gif";
        document.getElementById("str10").src = "images/Gry-star.gif";
    }
    else if (parseInt(bdat[0]) == parseInt(3)) {
        document.getElementById("str1").src = "images/Y-star.gif";
        document.getElementById("str2").src = "images/Y-star.gif";
        document.getElementById("str3").src = "images/Y-star.gif";
        document.getElementById("str4").src = "images/Gry-star.gif";
        document.getElementById("str5").src = "images/Gry-star.gif";

        document.getElementById("str6").src = "images/Y-star.gif";
        document.getElementById("str7").src = "images/Y-star.gif";
        document.getElementById("str8").src = "images/Y-star.gif";
        document.getElementById("str9").src = "images/Gry-star.gif";
        document.getElementById("str10").src = "images/Gry-star.gif";

    }
    else if (parseInt(bdat[0]) == parseInt(4)) {
        document.getElementById("str1").src = "images/Y-star.gif";
        document.getElementById("str2").src = "images/Y-star.gif";
        document.getElementById("str3").src = "images/Y-star.gif";
        document.getElementById("str4").src = "images/Y-star.gif";
        document.getElementById("str5").src = "images/Gry-star.gif";

        document.getElementById("str6").src = "images/Y-star.gif";
        document.getElementById("str7").src = "images/Y-star.gif";
        document.getElementById("str8").src = "images/Y-star.gif";
        document.getElementById("str9").src = "images/Y-star.gif";
        document.getElementById("str10").src = "images/Gry-star.gif";
    }
    else if (parseInt(bdat[0]) == parseInt(5)) {
        document.getElementById("str1").src = "images/Y-star.gif";
        document.getElementById("str2").src = "images/Y-star.gif";
        document.getElementById("str3").src = "images/Y-star.gif";
        document.getElementById("str4").src = "images/Y-star.gif";
        document.getElementById("str5").src = "images/Y-star.gif";

        document.getElementById("str6").src = "images/Y-star.gif";
        document.getElementById("str7").src = "images/Y-star.gif";
        document.getElementById("str8").src = "images/Y-star.gif";
        document.getElementById("str9").src = "images/Y-star.gif";
        document.getElementById("str10").src = "images/Y-star.gif";
    }
}


/**
* Function Name : printStroy
* Purpose : This function is use to print story.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function printStroy() {
    var boxid = document.getElementById("txtboxid").value;
    var parentid = document.getElementById("txtparentid").value;
    var x = window.open("print.aspx?id=" + parentid + "&boxid=" + boxid + "&valueprint=textPrint", "", "toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=0,left=0,width=338,height=327,titlebar=no");
}

function printImageStroy() {
    var boxid = document.getElementById("txtboxid").value;
    var parentid = document.getElementById("txtparentid").value;
    var x = window.open("print.aspx?id=" + parentid + "&boxid=" + boxid + "&valueprint=storyPrint", "", "toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=0,left=0,width=338,height=327,titlebar=no");
}

function pagePrint() {
    var url = document.getElementById('imgpage').src.replace("epaperimages", "epaperimages").replace(".png", ".pdf");
    var boxid = document.getElementById("txtboxid").value;
    var parentid = document.getElementById("txtparentid").value;
    var x = window.open("print.aspx?id=" + parentid + "&boxid=" + boxid + "&valueprint=pagePrint&url=" + url, "", "toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=0,left=0,width=338,height=327,titlebar=no");
}
/**
* Function Name : saveImageAs
* Purpose : This function is use to save story.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function saveImageAs() {
    //var imgOrURL=document.getElementById('imagePath').value;
    //if (typeof imgOrURL == 'object')
    //imgOrURL = imgOrURL.src;
    //window.win = open (imgOrURL);
    //setTimeout('win.document.execCommand("SaveAs")', 500);
    var imgOrURL = parent.document.getElementById('imgpage').src.replace("epaperimages", "epaperimages").replace(".png", ".pdf");
    if (typeof imgOrURL == 'object')
        imgOrURL = imgOrURL.src;
    window.win = open(imgOrURL);
    setTimeout('win.document.execCommand("SaveAs")', 500);
}



/**
* Function Name : sentComment
* Purpose : This function is use to sent comment.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function sentComment() {
    var boxid = document.getElementById("txtboxid").value;
    var parentid = document.getElementById("txtparentid").value;
    var x = window.open("feedback.aspx?id=" + parentid + "&boxid=" + boxid, "", "toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=150,left=350,width=638,height=320,titlebar=no");
}

/**
* Function Name : increaseFontSize()
* Purpose : This function is use to incress font size.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
var min = 14;
var max = 28;
function increaseFontSize() {
    var p = document.getElementsByTagName('p');
    for (i = 0; i < p.length; i++) {
        if (p[i].style.fontSize) {
            var s = parseInt(p[i].style.fontSize.replace("px", ""));
        } else {
            var s = 14;
        }
        if (s != max) {
            s += 3;
        }
        p[i].style.fontSize = s + "px"
    }
}


/**
* Function Name : decreaseFontSize()
* Purpose : This function is use to decress font size.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function decreaseFontSize() {
    var p = document.getElementsByTagName('p');
    for (i = 0; i < p.length; i++) {
        if (p[i].style.fontSize) {
            var s = parseInt(p[i].style.fontSize.replace("px", ""));
        } else {
            var s = 14;
        }
        if (s != min) {
            s -= 3;
        }
        p[i].style.fontSize = s + "px"
    }
}


/**
* Function Name : searchValue()
* Purpose : This function is use to search the value.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function searchValue() {
    if (document.getElementById('txtsearch').value == "") {
        alert('Please enter the keywords for search.');
        document.getElementById('txtsearch').focus();
        return false;
    }

}

function sendToSearch(event) {
    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if (keyCode == 13) {
        goToSearch();
        return false;
    }

}


function emptySearch() {
    if (document.getElementById('search').value == "keyword") {
        document.getElementById('search').value = "";
    }
    //document.getElementById('searchImg').focus();
}

function goToSearch() {
    if (document.getElementById('search').value == "keyword") {
        document.getElementById('search').focus();
        return false;
    }
    else if (document.getElementById('search').value == "") {
        alert('Please enter the keywords for search.');
        document.getElementById('search').focus();
        return false;
    }
    else {
        var keyValue = document.getElementById('search').value;
        //var x=window.open("search.aspx?search="+keyValue,"","toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=0,left=0,width=538,height=434,titlebar=no");	
        var srch = document.getElementById('search').value;
        document.getElementById('idivSearch').style.zIndex = 2

        parent.document.getElementById("showStoryHeadline").style.display = "none";
        parent.document.getElementById('ifrmContent').style.display = "none"
        parent.document.getElementById("storyZoom").style.display = "none";
        parent.document.getElementById("ifrmStory").style.display = "none";
        parent.document.getElementById('dvmainContent').style.display = "none";
        parent.document.getElementById("zoomPlus").style.display = "block";
        parent.document.getElementById("zoomMinus").style.display = "none";
        document.getElementById('idivSearch').style.display = "block";
        document.getElementById('ifrmsearch').style.display = "block";
        document.getElementById('ifrmsearch').src = "search.aspx?search=" + srch + "&issuedate123=" + parent.document.getElementById('txtdate').value + "&edd123=" + parent.document.getElementById('txtedition').value;
        closeHeadingPopup();
    }
}

/**
* Function Name : hideSearchDiv()
* Purpose : This function is use to hide the search window.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function hideSearchDiv() {
    parent.document.getElementById('idivSearch').style.display = "none";
    parent.document.getElementById('ifrmsearch').style.display = "none";
    document.getElementById('searchBlock_1').innerHTML = "<center><img src='facefiles/loading.gif' style='text-align:center;' /></center>";
}

/**
* Function Name : showheadline()
* Purpose : This function is use to show heading.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function showheadline(eddate, edcode, edpage, title) {
    var x = window.open("pageheadline.aspx?ed_date=" + eddate + "&ed_code=" + edcode + "&edpage=" + edpage + "&pgtitle=" + title, "", "toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=0,left=0,width=538,height=434,titlebar=no");
    //document.getElementById('dvheadline').src="pageheadline.aspx?ed_date="+eddate+"&ed_code="+edcode+"&edpage="+edpage+"&pgtitle="+title+"";
}

/**
* Function Name : bookmarksite()
* Purpose : This function is use to add this site bookmark.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function bookmarksite(title, url) {
    if (window.sidebar) // firefox
        window.sidebar.addPanel(title, url, "");
    else if (window.opera && window.print) { // opera
        var elem = document.createElement('a');
        elem.setAttribute('href', url);
        elem.setAttribute('title', title);
        elem.setAttribute('rel', 'sidebar');
        elem.click();
    }
    else if (document.all)// ie
        window.external.AddFavorite(url, title);
}

/**
* Function Name : scrollDown(),scrollUp()
* Purpose : This function is use to scroll up and
* scroll down Page.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
var scrollHeight = 100;
function scrollDown() {
    document.getElementById('pages').scrollTop = parseInt(document.getElementById('pages').scrollTop) + parseInt(scrollHeight);
}

function scrollUp() {
    document.getElementById('pages').scrollTop = parseInt(document.getElementById('pages').scrollTop) - parseInt(scrollHeight);
}

/**
* Function Name : Savepdf()
* Purpose : This function is use to save page.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function Savepdf() {
    var imgOrURL = document.getElementById('imgpage').src.replace("epaperimages", "epaperimages").replace(".png", ".pdf");
    if (typeof imgOrURL == 'object')
        imgOrURL = imgOrURL.src;
    window.win = open(imgOrURL);
    setTimeout('win.document.execCommand("SaveAs")', 500);
}

/**
* Function Name : Savepdf()
* Purpose : This function is use to save page.
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function pageEmail() {
    var setX = window.location.href;
    window.open("email.aspx?homeUrl=" + setX, "", "toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=150,left=350,width=540,height=240,titlebar=yes");
}


/**
* Function Name : onloadFunAdd()
* Purpose : This function is use to set the scroll
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function onloadFunAdd() {
    var isIE = (navigator.appName == "Microsoft Internet Explorer");
    var IEversion = navigator.appVersion;
    if (isIE) {
        IEversion = parseInt(IEversion.substr(IEversion.indexOf("MSIE") + 4));
    } else {
        IEversion = 0;
    }
    var checkBrowser = "isIE=" + isIE + ", version=" + IEversion;

    if (checkBrowser.indexOf("version=7") >= 0) {
        if (parseInt(screen.width) > 1279 && parseInt(screen.height) > 599) {
            document.getElementById("panel").style.left = "360px";
            document.getElementById("slidefooter").style.left = "360px";
            document.getElementById("panel").style.paddingBottom = "12";
        }
        if (parseInt(screen.width) > 1279 && parseInt(screen.height) > 767) {
            document.getElementById("panel").style.left = "450px";
            document.getElementById("slidefooter").style.left = "450px";
            document.getElementById("panel").style.paddingBottom = "12";
        }
        else {
            document.getElementById("panel").style.left = "250px";
            document.getElementById("slidefooter").style.left = "250px";
            document.getElementById("panel").style.paddingBottom = "12";
            //document.getElementById("slidefooter").style.bottom="100px";
        }
    }

    if (document.getElementById("Topbar1$txtsubeditionlist")) {
        document.getElementById("m3").innerHTML = document.getElementById("Topbar1$txtsubeditionlist").value
    }
    if (document.getElementById("Topbar1_txtsubeditionlist")) {
        document.getElementById("m3").innerHTML = document.getElementById("Topbar1_txtsubeditionlist").value
    }

    if (document.getElementById("txtpageno").value == document.getElementById("txtfirstpage").value) {
        document.getElementById("divtl").style.display = "none";
        document.getElementById("divbl").style.display = "none";
    }
    else {
        document.getElementById("divtl").style.display = "block";
        document.getElementById("divbl").style.display = "block";
    }

    if (document.getElementById("txtpageno").value == document.getElementById("txtmaxpageno").value) {
        document.getElementById("divtr").style.display = "none";
        //document.getElementById("divbr").style.display = "none";
    }
    else {
        document.getElementById("divtr").style.display = "block";
        //document.getElementById("divbr").style.display = "block";
    }

    if (parseInt(document.getElementById('txtpageno').value) == parseInt(1)) {
        document.getElementById('pages').scrollTop = 0;
    }
    else {
        document.getElementById('pages').scrollTop = parseInt(200) * parseInt(document.getElementById('txtpageno').value) - parseInt(200);
    }
}


/**
* Function Name : HideSideSlide()
* Purpose : This function is use to set the scroll
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function HideSideSlide() {
    var imgR = document.getElementById('browseImage').src;
    if (imgR.indexOf('page_tab_r.jpg') > 0) {
        document.getElementById('browseImage').src = "images/page_tab.jpg";
    }
    else {
        document.getElementById('browseImage').src = "images/page_tab_r.jpg";
    }
    if (document.getElementById('rightSlideFocus').style.left == "1px") {
        document.getElementById('rightSlideFocus').style.left = "0px";
    }
    else if (document.getElementById('rightSlideFocus').style.left == "0px") {
        var setValue = setTimeout("setLeftDiv()", 500);
    }
}
function chnageLeftSideAr() {
    var imgR = document.getElementById('loadLeftAr').src;
    if (imgR.indexOf('left-btn_r.jpg') > 0) {
        document.getElementById('loadLeftAr').src = "images/left-btn.jpg";
    }
    else {
        document.getElementById('loadLeftAr').src = "images/left-btn_r.jpg";
    }
}
function setLeftDiv() {
    document.getElementById('rightSlideFocus').style.left = "1px"
}

/**
* Function Name : showTL(),hideTL(),showTR(),hideTR(),showBL(),hideBL()
* showBR(),hideBR()
* Purpose : This function is use to flip page
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function showTL() {
    document.getElementById("shtl").style.visibility = "visible";
}

function hideTL() {
    document.getElementById("shtl").style.visibility = "hidden";
}

function showTR() {
    document.getElementById("shttr").style.visibility = "visible";
}

function hideTR() {
    document.getElementById("shttr").style.visibility = "hidden";
}

function showBL() {
    document.getElementById("shtbl").style.visibility = "visible";
}

function hideBL() {
    document.getElementById("shtbl").style.visibility = "hidden";
}

function showBR() {
    document.getElementById("shtbr").style.visibility = "visible";
}

function hideBR() {
    document.getElementById("shtbr").style.visibility = "hidden";
}


/**
* Function Name : chnageHeadingClass()
* Purpose : This function is use to change page title
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function chnageHeadingClass(obj, obj1) {
    //parent.document.getElementById("facebox").style.width="550px"
    var i = 0;
    var j = parseInt(document.getElementById('txtmaxpageno').value);
    for (i = 0; i < j; i++) {
        if (document.getElementById('divpagehead_' + i) != null) {
            document.getElementById('divpagehead_' + i).className = 'deselectTableContent';
            document.getElementById('spanhead_' + i).style.display = 'none';
        }
    }
    document.getElementById(obj).className = 'selectTableContent';
    document.getElementById(obj1).style.display = 'block';
    document.getElementById(obj1).style.display = 'inline';

}

/**
* Function Name : heading_include()
* Purpose : This function is use to open story
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function heading_include(lyr, url, id, winName) {
    var id = id;
    var boxid = winName;
    //    parent.document.getElementById('dvmainContent').style.zIndex=2
    //    parent.document.getElementById('dvmainContent').style.display="block";
    //    parent.document.getElementById('ifrmContent').style.display="block";
    //    parent.document.getElementById('ifrmContent').src="story.aspx?id="+ id + "&boxid=" + boxid;
    //    parent.document.getElementById("facebox").style.display="none";
    //document.getElementById('facebox').style.display="none";

}

/**
* Function Name : showDetail()
* Purpose : This function is use to open story
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function showDetail(boxid, id) {
    parent.document.getElementById('dvmainContent').style.zIndex = 2
    parent.document.getElementById('dvmainContent').style.display = "block";
    parent.document.getElementById('ifrmContent').style.display = "block";
    parent.document.getElementById('ifrmContent').src = "" + storyurl + "?id=" + id + "&boxid=" + boxid;
    parent.document.getElementById('idivSearch').style.display = "none";
    parent.document.getElementById('ifrmsearch').style.display = "none";
    return false;
}

/**
* Function Name : showParentPage()
* Purpose : This function is use to open page
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function showParentPage(eddate, edcode, querypage) {
    alert("hello");
    parent.window.location.href = "" + epaperurl + "?eddate=" + eddate + "&edcode=" + edcode + "&querypage=" + querypage;
}


/**
* Function Name : editThisStory()
* Purpose : This function is use to edit this story
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function editThisStory() {
    var boxid = document.getElementById("txtboxid").value;
    var parentid = document.getElementById("txtparentid").value;
    var edate = document.getElementById("txtparentid").value;
    var edate = document.getElementById("txtpdfdate").value;
    var url = "editstory.aspx?id=" + parentid + "&boxid=" + boxid + "&eddate=" + edate;
    window.open(url);
}

/**
* Function Name : showMinus()
* Purpose : This function is use to zoom minus image
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function showMinus() {
    document.getElementById("zoomPlus").style.display = "none";
    document.getElementById("zoomMinus").style.display = "block";
    parent.document.getElementById("showStoryHeadline").style.display = "none";
    parent.document.getElementById('ifrmContent').style.display = "none"
    parent.document.getElementById("storyZoom").style.display = "none";
    parent.document.getElementById("ifrmStory").style.display = "none";
    parent.document.getElementById('dvmainContent').style.display = "none";
    closeHeadingPopup();
}

/**
* Function Name : showPlus()
* Purpose : This function is use to zoom plus image
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function showPlus() {
    parent.document.getElementById("facebox").style.display = "none";
    document.getElementById("zoomPlus").style.display = "block";
    document.getElementById("zoomMinus").style.display = "none";
}

/**
* Function Name : closePopUp()
* Purpose : This function is use to hide facebox
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function closePopUp() {
    parent.document.getElementById("facebox").style.display = "none";
}

/**
* Function Name : hidePopupWindow()
* Purpose : This function is use to hide facebox,zoom images
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function hidePopupWindow() {
    parent.document.getElementById("footerid").style.width = "715px";
    parent.document.getElementById("facebox").style.display = "none";
    document.getElementById("zoomPlus").style.display = "block";
    document.getElementById("zoomMinus").style.display = "none";
}


/**
* Function Name : openHeadlinePopUp()
* Purpose : This function is use to show the page headline
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/

function openHeadlinePopUp(val,edate, edition, pageno, pagetitle) {
    document.getElementById("storyZoom").style.display = "none";
    document.getElementById("ifrmStory").style.display = "none";
    parent.document.getElementById('idivSearch').style.display = "none";
    parent.document.getElementById('ifrmsearch').style.display = "none";
    parent.document.getElementById('ifrmContent').style.display = "none"
    document.getElementById("showStoryHeadline").style.display = "block";
    document.getElementById("dvheadline").innerHTML = "<center><img src='facefiles/loading.gif' style='text-align:center;margin-top:200px;' /></center>";
    epapermain.showFullPageHeadine(val,edate, edition, pageno, pagetitle, callback_validatePageHeadline)
    return false;
}

function callback_validatePageHeadline(response) {
    var ds = response.value;
    var bdat = ds.split("$^$");
    document.getElementById("dvheadline").innerHTML = bdat[0];
    document.getElementById("lbltitle").innerHTML = bdat[1];
}

/**
* Function Name : openHeadlinePopUp()
* Purpose : This function is use to show the page headline
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function showStoryZoom(url) {
    document.getElementById("loadingZoomImg").style.display = "block";
    document.getElementById("ifrmStory").src = url;
    document.getElementById("dvheadline").innerHTML = "";
    document.getElementById("showStoryHeadline").style.display = "none";
}



function closeHeadingPopup() {
    var i = 0;
    var j = parseInt(document.getElementById('txtmaxpageno').value);
    for (i = 0; i < j; i++) {
        if (document.getElementById('divpagehead_' + i) != null) {
            document.getElementById('divpagehead_' + i).className = 'deselectTableContent';
            document.getElementById('spanhead_' + i).style.display = 'none';
        }
    }
    document.getElementById("showStoryHeadline").style.display = "none";
    document.getElementById("dvheadline").innerHTML = "<center><img src='facefiles/loading.gif' style='text-align:center;' /></center>";
    document.getElementById("lbltitle").innerHTML = "";
}


function closeZoomPopup() {
    var i = 0;
    parent.document.getElementById("facebox").style.zIndex = "100";
    var j = parseInt(document.getElementById('txtmaxpageno').value);
    for (i = 0; i < j; i++) {
        if (document.getElementById('divpagehead_' + i) != null) {
            document.getElementById('divpagehead_' + i).className = 'deselectTableContent';
            document.getElementById('spanhead_' + i).style.display = 'none';
        }
    }
    document.getElementById("storyZoom").style.display = "none";
    document.getElementById("ifrmStory").style.display = "none";
}

/**
* Function Name : showStoryZoom_photogallery()
* Purpose : This function is use to show the zoom story page
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function showStoryZoom_photogallery(url) {
    parent.document.getElementById("facebox").style.display = "block";
    parent.document.getElementById("facebox").style.zIndex = "0";
    parent.document.getElementById("ifrmStory").src = url;
    parent.document.getElementById("dvheadline").innerHTML = "";
    parent.document.getElementById("showStoryHeadline").style.display = "none";
    parent.document.getElementById("storyZoom").style.display = "block";
    parent.document.getElementById("ifrmStory").style.display = "block";
}

/**
* Function Name : moveToArchive()
* Purpose : This function is use for archive
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function moveToArchive() {
    //alert("s");
}

/**
* Function Name : showMouseOverStory()
* Purpose : This function is use for show story
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function showMouseOverStory() {
    var boxid = document.getElementById("txtbox").value;
    var id = document.getElementById("txtparent").value;
    var pageno = document.getElementById("txtpagenew").value;
    var edition = document.getElementById("txtedt").value;
    var edate = parent.document.getElementById("txtdate").value;
    document.getElementById('dvmainContent').style.zIndex = 2
    document.getElementById('dvmainContent').style.display = "block";
    document.getElementById('ifrmContent').style.display = "block";
    document.getElementById('ifrmContent').src = "" + storyurl + "?id=" + id + "&boxid=" + boxid + "&ed_date=" + edate;

}

/**
* Function Name : showMouseOverStory()
* Purpose : This function is use for show zoom story
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function showMouseOverStoryZoom() {
    var boxid = parent.document.getElementById("txtbox").value;
    var id = parent.document.getElementById("txtparent").value;
    var pageno = parent.document.getElementById("txtpagenew").value;
    var edition = parent.document.getElementById("txtedt").value;
    var edate = parent.document.getElementById("txtdate").value;
    var url = "zoomstoryout.aspx?ed_date=" + edate + "&parentid=" + id + "&boxid=" + boxid + "&ed_code=" + edition + "&ed_page=" + pageno;
    parent.document.getElementById("loadingZoomImg").style.display = "block";
    parent.document.getElementById("ifrmStory").src = url;
    parent.document.getElementById("dvheadline").innerHTML = "";
    parent.document.getElementById("showStoryHeadline").style.display = "none";
    parent.document.getElementById('ifrmContent').style.display = "none"
}

/**
* Function Name : closeAllPopup()
* Purpose : This function is use for archive
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function closeAllPopup(event) {
    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if (keyCode == 27) {
        parent.document.getElementById("showStoryHeadline").style.display = "none";
        parent.document.getElementById('ifrmContent').style.display = "none"
        parent.document.getElementById("storyZoom").style.display = "none";
        parent.document.getElementById("ifrmStory").style.display = "none";
        parent.document.getElementById('dvmainContent').style.display = "none";
        parent.document.getElementById('idivSearch').style.display = "none";
        parent.document.getElementById('ifrmsearch').style.display = "none";
        parent.document.getElementById("zoomPlus").style.display = "block";
        parent.document.getElementById("zoomMinus").style.display = "none";
        parent.document.getElementById("facebox").style.zIndex = "100";
        closeHeadingPopup();
    }
}

/**
* Function Name : changeOverStoryImage()
* Purpose : This function is use change images on mouseover and mouseout
* Date of Creation: 14-February-2011
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function changeOverStoryImage(imgPath, obj) {
    document.getElementById(obj).src = imgPath;
}

function moveToArchive() {
    if (document.getElementById("txtarhivedate").value == "") {

        var t = setTimeout("gotoArchive()", 500)
    }
}

function gotoArchive() {
    var edate = document.getElementById("txtarhivedate").value;
    var edcode = document.getElementById("txtedition").value
    var edName = document.getElementById("txteditionname").value;
   // alert(edName);
    epapermain.validatedate(edcode, edate, edName, callback_validatedate_new)
    return false;
}

function callback_validatedate_new(response) {
    var edate = document.getElementById("txtarhivedate").value;
    var edcode = document.getElementById("txtedition").value;
    var EdNAme = document.getElementById("txteditionname").value;
    var ds = response.value;
    //alert(ds);
    if (ds == "False") {
        alert("Sorry!This date archive is not Available!")
        document.getElementById("txtarhivedate").value = "";
    }
    else {

        //alert(edate);
        EdNAme = EdNAme.replace(" ", "-");
        edate = edate.replace("/", "-");
        edate = edate.replace("/", "-");
        //alert(edate);
        //alert("epaper/" + edate + "-"+edcode+"-"Page-1.html");
        //alert('epaper/' + edate + '-' + edcode + '-Page-1.html');
        var GetDT = edate.split("-");
        var DD = GetDT[2];
        var MM = GetDT[1];
        var YY = GetDT[0];
        //alert(MM);
        if (MM == "01") { MM = "jan"; }
        if (MM == "02") { MM = "feb"; }
        if (MM == "03") { MM = "mar"; }
        if (MM == "04") { MM = "apr"; }
        if (MM == "05") { MM = "may"; }
        if (MM == "06") { MM = "jun"; }
        if (MM == "07") { MM = "jul"; }
        if (MM == "08") { MM = "aug"; }
        if (MM == "09") { MM = "sep"; }
        if (MM == "10") { MM = "oct"; }
        if (MM == "11") { MM = "nov"; }
        if (MM == "12") { MM = "dec"; }
        var FDate = DD + "-" + MM + "-" + YY;
        window.location.href = "epaper/" + FDate + "-" + edcode + "-edition-" + EdNAme + "-Page-1.html";
        // window.location.href = "epapermain.aspx?eddate=" + edate + "&edcode=" + edcode;
        //alert(epaper/" + edate + "-"+edcode+"-"Page-1.html);
        //window.location.href = "epaper/" + edate + "-"+edcode+"-"Page-1.html";
        //window.location.href = "" + epaperurl + "?eddate=" + edate + "&edcode=" + edcode;
    }
}



function checkEdition() {
    alert("This edition is not available today!!!!");
    return false;
}


function openQuickEdition(eddate) {
    var selObj;
    //alert(eddate);
    if (document.getElementById('topsubedition')) {
        selObj = document.getElementById('topsubedition')
    }
    var selIndex = selObj.selectedIndex;
    var edcode = selObj.options[selIndex].value;
    var EdNAme = selObj.options[selIndex].text;
    if (edcode == "noedition") {
        alert("This edition is not available today!!!!");
    }
    else {

        //alert(EdNAme);

        EdNAme = EdNAme.replace(" ", "-");
        //edate = edate.replace("/", "-");
        //edate = edate.replace("/", "-");
        
        
        var GetDT = eddate.split("-");
        var DD = GetDT[2];
        var MM = GetDT[1];
        var YY = GetDT[0];
        //alert(MM);
        if (MM == "01") { MM = "jan"; }
        if (MM == "02") { MM = "feb"; }
        if (MM == "03") { MM = "mar"; }
        if (MM == "04") { MM = "apr"; }
        if (MM == "05") { MM = "may"; }
        if (MM == "06") { MM = "jun"; }
        if (MM == "07") { MM = "jul"; }
        if (MM == "08") { MM = "aug"; }
        if (MM == "09") { MM = "sep"; }
        if (MM == "10") { MM = "oct"; }
        if (MM == "11") { MM = "nov"; }
        if (MM == "12") { MM = "dec"; }
        var FDate = DD + "-" + MM + "-" + YY;
        window.location.href = "epaper/" + FDate + "-" + edcode + "-edition-" + EdNAme + "-Page-1.html";
        //var url = "" + epaperurl + "?eddate=" + eddate + "&edcode=" + edcode;
        //alert("epaper/" + FDate + "-" + edcode + "-Page-1.html");
        //alert("kk");
        //window.location.href = url;
    }

}





