var w=1000;
var h=700;
var doc='http://www.ajax13.com/all/docs/welcome.odp'; //http://www.ajax13.com/all/docs/welcome.odp
var wrt='';
var a;

function launch (app,path,sub) {
	//america servers
    app=app.replace('app3','app5'); // replace app3 to app5

    //europe servers
    var j = Math.random();
    if (j > 0.5) {
        app=app.replace('app6','app5'); //.replace('app3','app5');
    }
	
	//if the browser is not firefox then display error page
    if (!('product' in window.navigator)||window.navigator.product!='Gecko')
        app='http://www.ajax13.com/en/internal/ajaxxls-noffox.html';
    if(a)
        a.close();
    	a=window.open(app+'?doc='+wrt,'write',
                  'chrome,resizable=yes,dialog=no,all,width='+w+',height='+h+
                  ',left='+Math.floor((window.screen.width-w)/2)+
                  ',top='+Math.floor((window.screen.height-h)/2));
    if (!a||a.closed)
        alert ('Your browser settings prevent this app to run. Probably you need to allow your popup manager to open this site.');
}//launch


function launchp (app,path,sub) {
	//america servers
    app=app.replace('app3','app5'); // replace app3 to app5

    //europe servers
    var j = Math.random();
    if (j > 0.5) {
        app=app.replace('app6','app5'); //.replace('app3','app5');
    }
	
	//if the browser is not firefox then display error page
    if (!('product' in window.navigator)||window.navigator.product!='Gecko')
        app='http://www.ajax13.com/en/internal/ajaxxls-noffox.html';
    if(a)
        a.close();
    	a=window.open(app+'?doc='+doc,'write',
                  'chrome,resizable=yes,dialog=no,all,width='+w+',height='+h+
                  ',left='+Math.floor((window.screen.width-w)/2)+
                  ',top='+Math.floor((window.screen.height-h)/2));
    if (!a||a.closed)
        alert ('Your browser settings prevent this app to run. Probably you need to allow your popup manager to open this site.');
}//launch


function launchpresents (app,path,sub) {

    //america servers
    //var i = Math.random();
    //if (i >0.5) {
    app=app.replace('app3','app3'); // replace app3 to app5
    // }
    /*if (i > 0.333333 && i <= 0.666666) {
    	app=app.replace('app3','app7'); // replace app3 to app7
}*/
    //otherwise app3 does not get replace and stays app3

    //europe servers
    var j = Math.random();
    if (j >0.5) {
        app=app.replace('app6','app5'); //.replace('app3','app5');
    }
    /* if (j > 0.333333 && j <= 0.666666) {
     	app=app.replace('app6','app5'); // replace app3 to app7
     }*/
    //otherwise app2 does not get replace and stays app2




    if (!('product' in window.navigator)||window.navigator.product!='Gecko')
        app='http://www.ajax13.com/en/internal/ajaxxls-noffox.html';
    a=window.open(app+'?path=&user=&pass=&doc='+doc,'write',
                  'chrome,resizable=yes,dialog=no,all,width='+w+',height='+h+
                  ',left='+Math.floor((window.screen.width-w)/2)+
                  ',top='+Math.floor((window.screen.height-h)/2));
    if (!a||a.closed)
        alert ('Your browser settings prevent this app to run. Probably you need to allow your popup manager to open this site.');
}


function launchshareppt (app,path,sub) {

    //america servers
    app=app.replace('app3','app3'); //replace app3 to app5

    //europe servers
    var j = Math.random();
    if (j >0.5) {
        app=app.replace('app6','app5');
    }

    if (!('product' in window.navigator)||window.navigator.product!='Gecko')
        app='../../en/internal/ajaxwrite-noffox.html';
    a=window.open(app+'?path=&user=&pass=&doc=','write',
                  'chrome,resizable=yes,dialog=no,all,width='+w+',height='+h+
                  ',left='+Math.floor((window.screen.width-w)/2)+
                  ',top='+Math.floor((window.screen.height-h)/2));
    if (!a||a.closed)
        alert ('Your browser settings prevent this app to run. Probably you need to allow your popup manager to open this site.');
}