/** Javascript vom 05.12.05 */

if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
document.writeln('<script language="VBscript">');
document.writeln('detectableWithVB = False');
document.writeln('If ScriptEngineMajorVersion >= 2 then');
document.writeln('  detectableWithVB = True');
document.writeln('End If');
document.writeln('Function detectActiveXControl(activeXControlName)');
document.writeln('  on error resume next');
document.writeln('  detectActiveXControl = False');
document.writeln('  If detectableWithVB Then');
document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
document.writeln('  End If');
document.writeln('End Function');
document.writeln('</scr' + 'ipt>');
}

var popupPlug;

function buyOption(formName){

this.chosen = "";
this.formName = formName;
this.dataLenIE = new Array();
this.dataBuyIE = new Array();
this.dataAboIE = new Array();
this.dataLizIE = new Array();
this.dataLenFF = new Array();
this.dataBuyFF = new Array();
this.dataAboFF = new Array();
this.dataLizFF = new Array();
this.dataLenWMP = new Array();
this.dataBuyWMP = new Array();
this.dataAboWMP = new Array();
this.dataLizWMP = new Array();
this.dataErrIE = new Array();
this.dataErrWMP = new Array();
this.dataErrFF = new Array();

this.checkBrowser = function(){
var browserName = navigator.userAgent;
if (browserName.match(/Firefox/g)){

//Firefox
this.optionsFF();
}else{
if(external.DownloadManager){

//Internet Explorer
this.optionsWMP();
}else{
if (browserName.match(/MSIE/g)){
this.optionsIE();
}else{

//Unbekannt
alert("Browser Unbekannt");
}
}
}
}
this.getRadioValue = function(){
var i = 0;
for(i = 0; i < document.forms[this.formName].length; i++){
if(document.forms[this.formName].elements[i].checked == true){
return document.forms[this.formName].elements[i].name;
}
}
}
this.optionsIE = function(){
this.chosen = this.getRadioValue();
var koPopup;
if(this.chosen){
if(this.chosen.match(/lend/g)){
koPopup = window.open(this.dataLenIE[document.forms[this.formName].elements[this.chosen].value],'Lend','scrollbars=no,menubar=no,height=550,width=850,resizable=no,toolbar=no,location=no,status=no');
}else if (this.chosen.match(/buy/g)){
if(detectAX()){
koPopup = window.open(this.dataBuyIE[document.forms[this.formName].elements[this.chosen].value],'Buy');
if(popupPlug){
popupPlug.focus();
}
}else{
koPopup = window.open(this.dataErrIE[document.forms[this.formName].elements[0].value],'Buy');
}
}else if (this.chosen.match(/abo/g)){
koPopup = window.open(this.dataAboIE[document.forms[this.formName].elements[this.chosen].value],'ABO');
}else if (this.chosen.match(/lizenz/g)){
koPopup = window.open(this.dataLizIE[document.forms[this.formName].elements[this.chosen].value],'Lizenz','scrollbars=no,menubar=no,height=550,width=850,resizable=no,toolbar=no,location=no,status=no');
}
}
}
this.optionsFF = function(){
this.chosen = this.getRadioValue();
var koPopup;
if(this.chosen){
if(this.chosen.match(/lend/g)){
koPopup = window.open(this.dataLenFF[document.forms[this.formName].elements[this.chosen].value],'Lend');
koPopup.focus();
}else if (this.chosen.match(/buy/g)){
koPopup = window.open(this.dataBuyFF[document.forms[this.formName].elements[this.chosen].value],'Buy');
koPopup.focus();
}else if (this.chosen.match(/abo/g)){
koPopup = window.open(this.dataAboFF[document.forms[this.formName].elements[this.chosen].value],'ABO');
koPopup.focus();
}else if (this.chosen.match(/lizenz/g)){
koPopup = window.open(this.dataLizFF[document.forms[this.formName].elements[this.chosen].value],'Lizenz');
koPopup.focus();
}
if(koPopup){
koPopup.focus();
}
}
}
this.optionsWMP = function(){
this.chosen = this.getRadioValue();
if(this.chosen){
if(this.chosen.match(/lend/g)){
parent.location.href = this.dataLenWMP[document.forms[this.formName].elements[this.chosen].value];
}else if (this.chosen.match(/buy/g)){
if(detectAX()){
parent.location.href = this.dataBuyWMP[document.forms[this.formName].elements[this.chosen].value];
}else{
parent.location.href = this.dataErrWMP[0] + "?urlbuy=" + this.dataBuyWMP[document.forms[this.formName].elements[this.chosen].value];
}
}else if (this.chosen.match(/abo/g)){
parent.location.href = this.dataAboWMP[document.forms[this.formName].elements[this.chosen].value];
}else if (this.chosen.match(/lizenz/g)){
parent.location.href = this.dataLizWMP[document.forms[this.formName].elements[this.chosen].value];
}
}
}
this.clearRadiobuttons = function (formName, radioName){
document.forms[formName].reset();
document.forms[formName].elements[radioName].checked = true;
}
}


function detectAX() {
var pluginFound = detectActiveXControl('TOIDownloadManager.TOIDownloadCtrl.1');
if (pluginFound == true) {
// Browser hat das Plugin installiert
return true;
} else  {
// Browser hat das Plugin nicht installiert
return false;
}
}
