/* Browser detection */
var isIE = document.all;
var isIE6 = isIE && document.implementation;
var isIE5 = isIE && window.print && !isIE6;
var isIE4 = isIE && !isIEDOM2 && navigator.cookieEnabled;
var isIE3 = isIE && !isIE4 && !isIEDOM2;
var isNS = navigator.mimeTypes && !isIE;
var isNS3 = isNS && !navigator.language;
var isNS4 = document.layers;
var isNS6 = document.getElementById && !isIE;
var isNS7 = isNS6;
var isNS71 = document.designMode;
var isNSDOM2 = isNS6;
var isDOM2 = isIEDOM2 || isNSDOM2;
var isMacIE = document.all && !window.print;
var isSafari = navigator.userAgent.toLowerCase().indexOf("safari") > -1;
var isWin = navigator.userAgent.toLowerCase().indexOf("win") > -1;
var isMac = navigator.userAgent.toLowerCase().indexOf("mac") > -1;
var isOpera = (navigator.userAgent.toLowerCase().indexOf('opera') > -1); 
var isIEDOM2 = isIE5 || isIE6 && !isOpera;
var IsDom = document.getElementById
var IsSP2 = window.navigator.userAgent.toLowerCase().indexOf("sv1") > -1
/*var isIE = document.all;
var isIE6 = isIE && document.implementation;
var isIE5 = isIE && window.print && !isIE6;
var isIEDOM2 = isIE5 || isIE6;
var isIE4 = isIE && !isIEDOM2 && navigator.cookieEnabled;
var isIE3 = isIE && !isIE4 && !isIEDOM2;
var isNS = navigator.mimeTypes && !isIE;
var isNS3 = isNS && !navigator.language;
var isNS4 = document.layers;
var isNS6 = document.getElementById && !isIE;
var isNS7 = isNS6;
var isNS71 = document.designMode;
var isNSDOM2 = isNS6;
var isDOM2 = isIEDOM2 || isNSDOM2;
var isMacIE = document.all && !window.print;
*/
function PLg(obj){
if(document.all && !document.getElementById){return document.all[id]}
else if(document.layers){return document.layers[id]}
else{return document.getElementById(obj)}
}
function PLgetPosLeft(obj){if (obj.offsetParent)return (obj.offsetLeft + PLgetPosLeft(obj.offsetParent));else return (obj.offsetLeft)}
function PLgetPosTop(obj){if (obj.offsetParent)return (obj.offsetTop + PLgetPosTop(obj.offsetParent));else return (obj.offsetTop)}

String.prototype.isValidEmail = function () {
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    return re.test(this);
}
String.prototype.Trim = function () {
	return this.replace(/\s+/g,"");
}
String.prototype.WrongChars = function () {
	if(this.indexOf('"')>-1)return 1
}
var CorrectChars="a b c d e f g h i j k l m n o p q r s t u vw x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4  5 6 7 8 9";

function PLbubble(e){
if(isIE)event.cancelBubble=true;
else e.stopPropagation();
}

function ShowCat(arg){
if(PLg('cat'+arg).style.display=='none')
	PLg('cat'+arg).style.display='block'
else PLg('cat'+arg).style.display='none'
}

function DownloadSelection(){
	window.location = 'selection.cfm'+SessionValuestring;
}

function JumpTo(url){
	window.location=url+SessionValuestring
}

function OpenWin(theURL,winName,varWidth, varHeight){
  window.open(theURL, winName,'width='+varWidth+',height='+varHeight+',resizable=no,scrollbars=yes')
}
var thewidth=490,theheight=400;
function ShowDetail(idmedia){
	if(screen.availWidth){if(screen.availWidth<800){thewidth=490;theheight=400;w=1} else{thewidth=780;theheight=550;w=2}}
	TheUrl = '/detail.cfm'+SessionValuestring+'&idmedia='+idmedia+'&w='+w
	window.open(TheUrl,'detailView','location=no,status=yes,menubar=no,toolbar=no,resizable=yes,scrollbars=yes,width='+thewidth+',height='+theheight+',left='+GetWinCenter(1)+',top='+GetWinCenter(0))
}

function GetWinCenter(arg){
	if(arg){return (screen.availWidth/2)-(thewidth/2)}
	else{return (screen.availHeight/2)-(theheight/1.5)
	}
}

function DoIdent(){
mark=0
PLg('LOG_login').className='MDG_input'
PLg('LOG_password').className='MDG_input'
	if(!PLg('LOG_login').value.isValidEmail()){
		PLg('LOG_login').className='MDG_inputError'
		PLg('LOG_login').value=MSSG_formErrorLogin;
		PLg('LOG_login').onfocus=ResetSearchFieldAlert;
		mark++
	}
	
	if(PLg('LOG_password').value.Trim()==''){
		PLg('LOG_password').className='MDG_inputError'
		PLg('LOG_password').onfocus=ResetSearchFieldAlert;
		mark++
	}
	if(mark>0){	
		return false;
	}
	else{
		PLg('login_form').submit()
	}
}

function GetKeyPress(arg){
	if(isIE){
		key = event.keyCode
		if(key==13){
			eval(arg+'()')
		}
	}
}

function SearchWord(arg,pop){
	if(pop){
			window.opener.location='searchresults.cfm'+SessionValuestring+'&str='+escape(arg.Trim());
			window.close()
	}
	else{document.location='searchresults.cfm'+SessionValuestring+'&str='+escape(arg.Trim())}
}

function SendSearch(FromWhere){
if(PLg(FromWhere+'searchPictures')){
	isp=PLg(FromWhere+'searchPictures').src.indexOf('_.gif')>-1?'1':'0';
}else{isp='0'}
	
if(PLg(FromWhere+'searchMaps')){
	ism=PLg(FromWhere+'searchMaps').src.indexOf('_.gif')>-1?'4':'0';
}else{ism='0'}
		
if(PLg(FromWhere+'searchVideos')){
	isv=PLg(FromWhere+'searchVideos').src.indexOf('_.gif')>-1?'2':'0';
}else{isv='0'}
		
if(PLg(FromWhere+'searchPDF')){
	ispdf=PLg(FromWhere+'searchPDF').src.indexOf('_.gif')>-1?'3':'0';
}else{ispdf='0'}

if(isp==0 && ism==0 && isv==0 && ispdf==0){
	alert(MSSG_SelectTypeToSearch)
}
else{
TheString=PLg(FromWhere+'searchString').value
	if(!TheString.Trim() || TheString.Trim().length<2 || TheString==MSSG_enterSearchString){
		PLg(FromWhere+'searchString').className='MDG_inputError'
		PLg(FromWhere+'searchString').onfocus=ResetSearchFieldAlert;
		PLg(FromWhere+'searchString').value=MSSG_enterSearchString;
	}
	else{
		Mask='isp='+isp+'&ism='+ism+'&isv='+isv+'&ispdf='+ispdf;
	window.location='searchresults.cfm'+SessionValuestring+'&'+Mask+'&str='+escape(TheString);
	}
}
}

function ResetSearchFieldAlert(){
	this.className='MDG_input'
	this.onfocus=null
	this.value=''
}

function KeySendSearch(FromWhere){
	if(isIE){
		key = event.keyCode
		if(key==13){
			if(FromWhere=='advanced'){
				SendAdvSearch()
			}
			else{
				SendSearch(FromWhere)
			}
		}
	}
}

function renameLigthBox(IDLIGHTBOX,TITLE){
	var LBReName = AskPrompt(TITLE)
	if(LBReName!=null){
		if(LBReName.length>16)LBReName=LBReName.substring(0,16)
		if(LBReName.Trim()){
			var now = new Date()
			addURL = "/actions/RenameLightbox.cfm"+SessionValuestring+"&lightbox="+IDLIGHTBOX+"&LBTitle="+escape(LBReName)+"&nc="+now.getTime();
			var addPage = new Image();
			addPage.onload  = ReloadCurrentPage;
			addPage.onerror = ReloadCurrentPage;
			addPage.onabort = ReloadCurrentPage;
			addPage.src = addURL;
		}
	}
}

function DeleteLightBox(IDLIGHTBOX){
	if(confirm(MSSG_confirmDeletLB)){
		window.location="/actions/DeleteLightbox.cfm"+SessionValuestring+"&lightbox="+IDLIGHTBOX
	}
}

function CreateNewLB(){
	TheString=PLg('searchString').value.Trim();
	if(TheString.length>16)TheString=TheString.substring(0,16)
	var NewLBName = AskPrompt(TheString)
	if(NewLBName!=null){
		if(NewLBName.length>16)NewLBName=NewLBName.substring(0,16)
		if(NewLBName.Trim() && NewLBName!=MSSG_enterSearchString){
			var now = new Date()
			addURL = "/actions/CreateLightbox.cfm"+SessionValuestring+"&LBTitle="+escape(NewLBName)+"&nc="+now.getTime();
			var addPage = new Image();
			addPage.onload  = ReloadCurrentPage;
			addPage.onerror = ReloadCurrentPage;
			addPage.onabort = ReloadCurrentPage;
			addPage.src = addURL;
		}
		else{
			alert(MSSG_GiveLBname)
		}
	}
}

function AskPrompt(TheString){
	return prompt(MSSG_NewLBname,TheString)
}

var MediasTypesLB = new Array()
	MediasTypesLB[1] = new Array()
	MediasTypesLB[1][1] = "Image"
	MediasTypesLB[1][2] = "Picture"
	MediasTypesLB[1][3] = "Bild"
	MediasTypesLB[1][4] = "Imagen"
	MediasTypesLB[1][5] = "Bild"
	
	MediasTypesLB[2] = new Array()
	MediasTypesLB[2][1] = "Video"
	MediasTypesLB[2][2] = "Video"
	MediasTypesLB[2][3] = "Bildschirm"
	MediasTypesLB[2][4] = "Video"
	MediasTypesLB[2][5] = "Bildschirm"
	
	MediasTypesLB[3] = new Array()
	MediasTypesLB[3][1] = "PDF"
	MediasTypesLB[3][2] = "PDF"
	MediasTypesLB[3][3] = "PDF"
	MediasTypesLB[3][4] = "PDF"
	MediasTypesLB[3][5] = "PDF"
	
	MediasTypesLB[4] = new Array()
	MediasTypesLB[4][1] = "Schéma"
	MediasTypesLB[4][2] = "Diagram"
	MediasTypesLB[4][3] = "Diagramm"
	MediasTypesLB[4][4] = "Diagrama"
	MediasTypesLB[4][5] = "Diagramm"

function RedrawSelection(){
	if(CurrentSelectionArray.length>0){
		data='';
		for(k=0;k<CurrentSelectionArray.length;k++){
			if(CurrentSelectionArray[k][0]!=""){
			data+='<a href="javascript:ShowDetail(\''+CurrentSelectionArray[k][0]+'\')"><img src="'+CurrentSelectionArray[k][1]+'" hspace="2" vspace="2" title="media : '+CurrentSelectionArray[k][0]+' \ntype : '+MediasTypesLB[CurrentSelectionArray[k][2]][CurrentLanguage]+'"></a> '
			}
		}
		PLg('selectionDisplay').innerHTML=data;
		PLg('selectionSubmit').style.display='block';
		window.setTimeout("SetSelectionBoxHeight()","100")
	}
}
function SetSelectionBoxHeight(){
	if(PLg('selectionDisplay').offsetHeight>90){
		PLg('selectionDisplay').style.height='90px'
	}
/*	else{
		if(!isIE){PLg('selectionDisplay').style.height=(CurrentSelectionArray.length/5)*40;}	
	}
*/
}

function AddToSelection(IDMEDIA,CHEMIN,MEDIATYPE){
isAlreadyPresent=0
for(z=0;z<CurrentSelectionArray.length;z++){
	if(CurrentSelectionArray[z][0]==parseInt(IDMEDIA,10)){
		isAlreadyPresent++;
		z=CurrentSelectionArray.length;
		DisplayNotification(MSSG_SelIsAlreadyPresent)
		window.status = MSSG_SelIsAlreadyPresent
	}
}

	if(isAlreadyPresent==0){
		var now = new Date();
		addURL = "/actions/addToselection.cfm"+SessionValuestring+"&idmedia=" + IDMEDIA + "&nc=" + now.getTime();
		var addPage = new Image();
			addPage.onload = ResetStatusBarre;
			addPage.onerror = ResetStatusBarre;
			addPage.onabort = ResetStatusBarre;
			addPage.src = addURL;
			
			window.status = MSSG_LBAddinProgress;

			CurrentSelectionArray[CurrentSelectionArray.length]=new Array(IDMEDIA,CHEMIN);
			
			if(PLg('selectionDisplay').innerHTML.indexOf('<EM>')!=-1 || PLg('selectionDisplay').innerHTML.indexOf('-empty-')!=-1){
				PLg('selectionDisplay').innerHTML="";
			}
			PLg('selectionDisplay').innerHTML+='<a href="javascript:ShowDetail(\''+IDMEDIA+'\')"><img src="'+CHEMIN+'" hspace="2" vspace="2" title="media : '+IDMEDIA+'\ntype : '+MediasTypesLB[MEDIATYPE][CurrentLanguage]+'"></a> ';
			PLg('selectionSubmit').style.display='block';
	
			if(PLg('selectionDisplay').offsetHeight>90){
				PLg('selectionDisplay').style.height=PLg('selectionDisplay').offsetHeight
			}
	}
}

function SetDownloadFormat(IDMEDIA,DWNLDLEVEL){
	var now = new Date()
		addURL = "/actions/setDownloadLevel.cfm"+SessionValuestring+"&IDMEDIA=" + IDMEDIA + "&LEVEL="+DWNLDLEVEL+"&nc=" + now.getTime();
		var addPage = new Image();
			addPage.onload  = ResetStatusBarre;
			addPage.onerror = ResetStatusBarre;
			addPage.onabort = ResetStatusBarre;
			window.status = MSSG_ModifInProgress;
			addPage.src = addURL;
	RadioBox(IDMEDIA,DWNLDLEVEL)
}

function RemoveFromSelection(IDMEDIA){
	var now = new Date()
		addURL = "/actions/remFromSelection.cfm"+SessionValuestring+"&idmedia=" + IDMEDIA + "&nc=" + now.getTime();
		var addPage = new Image();
			addPage.onload  = ResetStatusBarre;
			addPage.onerror = ResetStatusBarre;
			addPage.onabort = ResetStatusBarre;
			window.status = MSSG_LBReminProgress;
			addPage.src = addURL;
			
	IsSelEmpty=0;
	for(i=0;i<CurrentSelectionArray.length;i++){
		if(CurrentSelectionArray[i][0]==parseInt(IDMEDIA,10)){
			CurrentSelectionArray[i][0]="";
		}
		else if(CurrentSelectionArray[i][0]!=""){
			IsSelEmpty++
		}
	}
	PLg('TR_'+IDMEDIA).style.display='none';
	RedrawSelection()

	if(IsSelEmpty==0){
		PLg('IfAllSelMediasDeleted').innerHTML = MSSG_AllSelMediasDeleted
	}
}


function RemoveFromLigthbox(IDMEDIA,IDLIGHTBOX){
	isPresent=0;
	CurrentLigthBoxValues = PLg('LTB_'+IDLIGHTBOX).value.split(",")
	TMPCurrentLigthBoxValues = new Array();
	for(n=0;n<CurrentLigthBoxValues.length;n++){
		if(CurrentLigthBoxValues[n]==parseInt(IDMEDIA,10)){
			isPresent++;
		}
		else{
			TMPCurrentLigthBoxValues[TMPCurrentLigthBoxValues.length] = CurrentLigthBoxValues[n]
		}
	}
	
	if(isPresent>0){
	
		PLg('LTB_'+IDLIGHTBOX).value=TMPCurrentLigthBoxValues.join()
			var now = new Date()
			addURL = "/actions/remFromLightbox.cfm"+SessionValuestring+"&lightbox="+IDLIGHTBOX+"&idmedia=" + IDMEDIA + "&nc=" + now.getTime();

			var addPage = new Image();
				addPage.onload  = ResetStatusBarre;
				addPage.onerror = ResetStatusBarre;
				addPage.onabort = ResetStatusBarre;
				window.status = MSSG_LBReminProgress;
				addPage.src = addURL;
				
			PLg('TR_'+IDMEDIA).style.display='none';
			newVal=parseInt(PLg('ligthboxItemsNb_'+IDLIGHTBOX).innerHTML,10)			
			newVal--
			PLg('ligthboxItemsNb_'+IDLIGHTBOX).innerHTML=newVal;
	}
	
	if(TMPCurrentLigthBoxValues.length==0){
		PLg('IfAllLBMediasDeleted').innerHTML = MSSG_AllLBMediasDeleted;
		}	
}

function CurrentLigthBox(){
	if(!PLg('CurrLBMark')){
		alert(MSSG_NoLBAvailaible)
		CreateNewLB()
		return false
	}
	else if(PLg('CurrLBMark').value != ''){
		return PLg('CurrLBMark').value;
	}
	else{
		Coll = document.getElementsByTagName("input");
		for(i=0; i<Coll.length;i++){
			if(Coll[i].id.indexOf('LTB_')!=-1){
				swapLigthBox(Coll[i].id.substring(4,Coll[i].id.length))
				return Coll[i].id.substring(4,Coll[i].id.length)
			}
		}
	}
}

function AddToLigthbox(IDMEDIA){
if(!PLg('CurrLBMark')){
	CurrentLigthBox()
}
else{
	isAlreadyPresent=0;
	CurrentLigthBoxValues = PLg('LTB_'+CurrentLigthBox()).value.split(",")
	TMPCurrentLigthBoxValues = new Array();
	for(n=0;n<CurrentLigthBoxValues.length;n++){
		if(CurrentLigthBoxValues[n]==parseInt(IDMEDIA,10)){
			isAlreadyPresent++;
			n=CurrentLigthBoxValues.length;
			DisplayNotification(MSSG_LightIsAlreadyPresent)
			window.status = MSSG_LightIsAlreadyPresent
		}
	}

	if(isAlreadyPresent==0){
		var now = new Date()
		addURL = "/actions/addToLightbox.cfm"+SessionValuestring+"&lightbox="+CurrentLigthBox()+"&idmedia=" + IDMEDIA + "&nc=" + now.getTime();
		var addPage = new Image();
			addPage.onload  = ResetStatusBarre;
			addPage.onerror = ResetStatusBarre;
			addPage.onabort = ResetStatusBarre;
			addPage.src = addURL;
			window.status = MSSG_LBAddinProgress;
			
			if(PLg('LTB_'+CurrentLigthBox()).value==""){
				PLg('LTB_'+CurrentLigthBox()).value+=IDMEDIA
			}
			else{
				PLg('LTB_'+CurrentLigthBox()).value+=','+IDMEDIA
			}
	
			newVal=PLg('ligthboxItemsNb_'+CurrentLigthBox()).innerHTML
			newVal=parseInt(newVal,10)
			newVal=newVal+1
			PLg('ligthboxItemsNb_'+CurrentLigthBox()).innerHTML=newVal;
	}
}
}

function swapLigthBox(arg){
	if(arg!=PLg('CurrLBMark').value){
		PLg('CurrLBMark').value=arg;
		Coll = document.images;
		for(i=0; i<Coll.length;i++){
			if(Coll[i].id.indexOf('lightboxRadio_')!=-1){
				Coll[i].src=ClientsFolderDir+'/box.gif';
				Coll[i].offsetParent.className='MDG_cmenu_t1_lightbox'
			}
		}
		PLg('lightboxRadio_'+arg).src=ClientsFolderDir+'/box_.gif';
		PLg('lightboxTD_'+arg).className='MDG_cmenu_t1_lightbox_'
		
		var now = new Date()
		addURL = "/actions/setcurrentligthbox.cfm"+SessionValuestring+"&lightbox=" + arg + "&nc=" + now.getTime();
		var addPage = new Image();
			addPage.src = addURL;
	}
}

function DisplayNotification(arg,temp){
	PLg('NotificationDiv').innerHTML=arg
	PLg('NotificationDiv').style.left=PLgetPosLeft(PLg('MDG_BGcolor'))+((PLg('MDG_BGcolor').offsetWidth-170)/2)-60
	if(isIE){
		PLg('NotificationDiv').style.top=((parseInt(document.body.clientHeight,10)/2)-50)+parseInt(document.body.scrollTop,10)
	}
	else{
		PLg('NotificationDiv').style.top=((window.innerHeight/2)-50)+window.pageYOffset
	}
	
	PLg('NotificationDiv').style.display='inline'
	if(!temp)
	window.setTimeout("ResetDisplayNotification()","1200")
}

function ResetDisplayNotification(){
	PLg('NotificationDiv').style.display='none'
	window.status=''
}

function ResetStatusBarre(){window.status = ""}

function SwapHelp(){
	if(IsHelpActive){
		IsHelpActive=0
		PLg('swapHelp').innerHTML=MSSG_activateHelp
		PLg('MDG_helpBoxTable').style.visibility='hidden';
	}
	else{
		IsHelpActive=1
		PLg('swapHelp').innerHTML=MSSG_deactivateHelp
		PLg('MDG_helpBoxTable').style.visibility='visible';
	}
	var now = new Date()
	addURL = "/actions/sethelpstatus.cfm"+SessionValuestring+"&status=" + IsHelpActive + "&nc=" + now.getTime();
	var addPage = new Image();
		addPage.src = addURL;
}

function ShowHelp(arg){
	if(IsHelpActive){
		if(eval('HLP_'+arg)){
			PLg('MDG_helpBox').innerHTML = eval('HLP_'+arg);
			if(isIEDOM2 && !isMacIE)window.event.srcElement.attachEvent('onmouseout',ResetHelp)
		}
	}
}

function ResetHelp(){
	window.status='';
	PLg('MDG_helpBox').innerHTML = HLP_idle;
	//window.event.srcElement.detachEvent('onmouseout', ResetHelp)
}

function CheckBox(arg){
	if(PLg(arg).src.indexOf('_.gif')==-1){
		PLg(arg).src=ClientsFolderDir+'/box_.gif'
	}
	else{
		PLg(arg).src=ClientsFolderDir+'/box.gif'
	}
}

function RadioBox(IDROOT,WICH){
	Coll = document.images
	for(i=0; i<Coll.length;i++){
		if(Coll[i].id.indexOf('radioBox_'+IDROOT+'_')!=-1){
			Coll[i].src=ClientsFolderDir+'/box.gif'
		}
	}
	PLg('radioBox_'+IDROOT+'_'+WICH).src=ClientsFolderDir+'/box_.gif'
}

function SwapLanguage(arg){
	var now = new Date()
	addURL = "/actions/setlangue.cfm"+SessionValuestring+"&lg=" + arg + "&nc=" + now.getTime();
	var addPage = new Image();
		addPage.onload  = ReloadCurrentPage;
		addPage.onerror = ReloadCurrentPage;
		addPage.onabort = ReloadCurrentPage;
		addPage.src = addURL;
}

function ReloadCurrentPage(){
	location.reload()
}

function GetWinSize(arg){
	if(isMacIE){
		if(arg=='w'){return parseInt(document.body.clientWidth-15,10)}
		else{
			return parseInt(document.body.clientHeight,10)+parseInt(document.body.scrollTop,10)
		}
	}
	else if(isIE){
		if(arg=='w'){return parseInt(document.body.clientWidth,10)}
		else{
			if(parseInt(document.body.scrollHeight,10) > parseInt(document.body.clientHeight,10)){
				return parseInt(document.body.scrollHeight,10)
			}
			else{
				return parseInt(document.body.clientHeight,10)
			}
		}
	}
	else{
		if(arg=='w'){return parseInt(window.innerWidth,10)-15;}
		else{return parseInt(window.innerHeight+window.pageYOffset,10)}
	}
}

/* Retourne le nombre de cases à cocher d'une page qui sont séléctionnés. */
function checkCheckedBoxs(){
CheckedItems=0;
Boxes=document.getElementsByTagName("input")
	for(i=0; i<Boxes.length;i++){
		if(Boxes[i].type=='checkbox'){
			if(Boxes[i].checked)CheckedItems++;
		}
	}
return CheckedItems
}

function Err_Handl(msg, url, ln){
		if(JSDebugBehav==1){
			if(isIE){
				alert('######################\n# PETITE ERREUR JAVASCRIPT... #\n######################\n\n'+msg+'\n\n____________________________________\n'+url+'\nLIGNE : '+ln)
				return true;
			}
		}
		else return true;
	}

//window.onerror=Err_Handl;

/* Detection Acrobat */

var acrobat=new Object();

function GetAcrobat(){
	acrobat.installed=false;
	acrobat.version='0.0';
	
	if(navigator.plugins && navigator.plugins.length){
		for(x=0; x<navigator.plugins.length; x++){
			if(navigator.plugins[x].description.indexOf('Adobe Acrobat') != -1){
				acrobat.version=parseFloat(navigator.plugins[x].description.split('Version ')[1]);
	
				if(acrobat.version.toString().length == 1) acrobat.version+='.0';
				acrobat.installed=true;
				break;
			}
		}
	}
	else if(window.ActiveXObject){
		for(x=2; x<10; x++){
			try{
				oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");
				if(oAcro){
					acrobat.installed=true;
					acrobat.version=x+'.0';
				}
			}
			catch(e){}
		}
		try{
			oAcro4=new ActiveXObject('PDF.PdfCtrl.1');
			if(oAcro4){
				acrobat.installed=true;
				acrobat.version='4.0';
			}
		}
		catch(e){}
	}
	
	acrobat.ver4=(acrobat.installed && parseInt(acrobat.version) >= 4) ? true:false;
	acrobat.ver5=(acrobat.installed && parseInt(acrobat.version) >= 5) ? true:false;
	acrobat.ver6=(acrobat.installed && parseInt(acrobat.version) >= 6) ? true:false;
	acrobat.ver7=(acrobat.installed && parseInt(acrobat.version) >= 7) ? true:false;
	acrobat.ver8=(acrobat.installed && parseInt(acrobat.version) >= 8) ? true:false;
	acrobat.ver9=(acrobat.installed && parseInt(acrobat.version) >= 9) ? true:false;
} 