/*## Acrobat PDF Object 3.2 (18.11.2010) ##*/
/* Google Viewer Implementation w/ Chrome support */
/* supports all Adobe Reader versions */

/*# CONTROL PDF VIEWER PRESENCE #*/
function is_acrobat_reader_installed(){

if(navigator.plugins.length>0){

for(var i=0;i<navigator.plugins.length;i++){

/* Firefox/Opera/Chrome + Foxit Reader */
if(navigator.plugins[i].description.indexOf("Portable Document Format")!=-1 || navigator.plugins[i].description.indexOf("Adobe PDF Plug-In For Firefox and Netscape")!=-1 || navigator.plugins[i].description.indexOf("Foxit Reader Plug-In For Firefox and Netscape")!=-1){

return true;
}
}
}
else if(window.ActiveXObject){

/* possible Acrobat Activex PDF Object names */
var activex_objects=new Array("AcroPDF.PDF.1","PDF.PdfCtrl.1","PDF.PdfCtrl.2","PDF.PdfCtrl.3","PDF.PdfCtrl.4","PDF.PdfCtrl.5","PDF.PdfCtrl.6","PDF.PdfCtrl.7","PDF.PdfCtrl.8","PDF.PdfCtrl.9");

for(var i=0;i<activex_objects.length;i++){

try{

var reader=new ActiveXObject(activex_objects[i]);

/* IE */
if(reader){

reader=null;
return true;
}
}
catch(e){}
}
}

return false;
};



/*# PDF EMBED #*/
function embed_pdf(pdf_name, pdf_url_path, container_id){

if(is_acrobat_reader_installed()){

/* open parameters */
pdf_name=pdf_name+"#navpanes=0&pagemode=none&page=1&view=fitH&messages=0&toolbar=1&scrollbar=1&statusbar=0";

/* html objects */
var pdf_object='<object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="100%" height="100%"><param name="src" value="'+pdf_name+'"><param name="type" value="application/pdf"><embed src="'+pdf_name+'" height="100%" width="100%" type="application/pdf" frameborder="no"></embed></object>';

/* embed using Acrobat PDF Plugin */
document.getElementById(container_id).innerHTML=pdf_object;
}
else{

/* embed using Google Viewer */
document.getElementById(container_id).innerHTML='<iframe style="width:100%;height:100%;" src="http://docs.google.com/viewer?url='+pdf_url_path+pdf_name+'&amp;embedded=true" frameborder="0"></iframe>';
}

return true;
};
