function checkview2() {
    return confirm("You are accessing a charged resource. \nYou need to be logged in and have sufficient units in order to view it.\n\n If you continue your account will be charged.\n\nContinue?");
    //return true;
}


function nooperation()
{
    return true;
}

function buyunits()
{
    document.purchaseunits.submit();
    return false;
}

function nopdf()
{
    alert("PDF unavailable online, please contact DCS Customer Services on 01452 835 820 or dcs@haymarket.com for further information");
    return false;
}
function checkview(anchor)
{
	var path = "downloadpopup.jsp";
	//var path = "ppuppvdownload.jsp?";
        var selected = "";

        var lnkpdf = document.getElementById("lnkpdf");
        lnkpdf.href = anchor.href;
        
        browsepopupwindow = window.open(path, "browse", 
	  "height=400px, width=650px, location=no, resizable=yes, status=no, menubar=no, toolbar=no, scrollbars=yes");
            

          return false;
}
function savefields()
{
    debugger;
    var fieldRef = document.getElementById("txtReference").value;
    var fieldName = document.getElementById("txtName").value;
    var parentControlContinue = window.opener.document.getElementById("hdContinue");
    parentControlContinue.value = "true";


     var parentControlref = window.opener.document.getElementById("hdReference");
     var parentControlName = window.opener.document.getElementById("hdName");
     //window.close();

     parentControlref.value = fieldRef;
     parentControlName.value = fieldName;

     window.opener.chargeContinue();


    window.close();
    return true;
}

function chargeCancel()
{
    var parentControlContinue = window.opener.document.getElementById("hdContinue");
    parentControlContinue.value = "false";

    window.close();
}


function chargeContinue()
{
        
         var vcontinue = document.getElementById("hdContinue");

          if (vcontinue.value == "true")
          {
                    var lnkpdf = document.getElementById("lnkpdf");
                    var reference = document.getElementById("hdReference");
                    var name = document.getElementById("hdName");
                    lnkpdf.href = lnkpdf.href + "&reference=" + reference.value + "&name=" + name.value;

                   if (navigator.appName == "Microsoft Internet Explorer")
                        lnkpdf.click();
                   else
                    {
                        //lnkpdf.onclick();
                        window.open(lnkpdf.href, "_self");
                    }
          }
          else
                return false;

}

function justdoit()
{
    return true;
}

function parentfocus()
{
   /* if (window.opener != null)
        window.opener.focus();  */

        var w = window.open('', 'compassmainwindow');

        if (w && !w.closed)
        {
            w.focus();
        }

        return true;
}

function fireEvent(obj,evt){
	
	var fireOnThis = obj;
	if( document.createEvent ) {
	  var evObj = document.createEvent('MouseEvents');
	  evObj.initEvent( evt, true, false );
	  fireOnThis.dispatchEvent(evObj);
	} else if( document.createEventObject ) {
	  fireOnThis.fireEvent('on'+evt);
	}
}


function  PrintPage()
{
    var obj = document.getElementById("form1:btnPrint");
    obj.className = "noprint";

    obj = document.getElementById("form1:hyperlinkPrev");
    if (obj != null)
        obj.className = "noprint";
    obj = document.getElementById("form1:hyperlinkNext");
    if (obj != null)
        obj.className = "noprint";

    window.print();

    obj = document.getElementById("form1:btnPrint");
    obj.className = "Btn2";


    obj = document.getElementById("form1:hyperlinkPrev");
    if (obj != null)
        obj.className = "";
    obj = document.getElementById("form1:hyperlinkNext");
    if (obj != null)
        obj.className = "";


    return false;
}


function  PrintPopup()
{
            browsepopupwindow = window.open("faces/searchresultsPrint.jsp", "print", 
	  "height=600px, width=700px, location=yes, resizable=yes, status=no, menubar=no, toolbar=no, scrollbars=yes");
              return false;
}
