var topMargin = 200
var slideTime = 1200
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);
window.setInterval("main()", 10)


strSplit = new String(window.location.href);
hrefSplit = strSplit.split("/");

var toLo = hrefSplit[hrefSplit.length - 1].toLowerCase();


var p = new String(hrefSplit[hrefSplit.length - 1]);
var pSplit = p.split(".");
if (pSplit[0].substr(pSplit[0].length-2,2) =="FR") {
	document.write(mstrFR);
}else {
	document.write(mstr);
}
if ((pSplit[0].substr(0,10)).toLowerCase() == "newsletter"){
	toLo = "newsletter"
}else if((pSplit[0].substr(0,12)).toLowerCase() == "testimonials"){
	toLo = "testimonials"
}else if((pSplit[0].substr(0,4)).toLowerCase() == "docs"){
	toLo = "docs"
}else if((pSplit[0].substr(0,8)).toLowerCase() == "feedback"){
	toLo = "feedback"
}
//***************************************************					
					
switch(toLo) {
	case "newsletter":
		topMargin = 270;	
		break;
	case "testimonials":
		topMargin = 245;	
		break;
	case "docs":
		topMargin = 245;	
		break;
	default:
		topMargin = 200;	
}

function floatObject() {
if (ns4 || ns6) {
		findHt = window.innerHeight;
	} else if(ie4) {
		findHt = document.body.clientHeight;
	}
}

function main() {
	if (toLo != "docs" && toLo != "feedback"){
		this.scrollRight = (document.body.clientWidth-760)/2;
		if (ns4) {
			this.currentY = document.floatLayer.top;
			this.currentX = document.floatLayer.right;
			this.scrollTop = window.pageYOffset;
			mainTrigger();
		} else if(ns6) {
			this.currentY = parseInt(document.getElementById('floatLayer').style.top + 0);
			this.currentX = parseInt(document.getElementById('floatLayer').style.right + 0);
			this.scrollTop = scrollY;
			mainTrigger();
		} else if(ie4) {
			this.currentY = floatLayer.style.pixelTop;
			this.currentX = floatLayer.style.pixelRight;
			this.scrollTop = document.body.scrollTop;
			mainTrigger();
		}
	} else {
		if (ns4) {
			document.floatLayer.display="none";
		} else if(ns6) {
			document.getElementById('floatLayer').style.display="none";
		} else if(ie4) {
			floatLayer.style.display="none";
		}
	}
}
function mainTrigger() {
	var newTargetY = this.scrollTop + this.topMargin
	if ( this.currentY != newTargetY ) {
		if ( newTargetY != this.targetY ) {
			this.targetY = newTargetY
			floatStart();
		}
		animator();
	}
}
function floatStart() {
	var now = new Date()
	this.A = this.targetY - this.currentY
	this.B = Math.PI / ( 2 * this.slideTime )
	this.C = now.getTime()
	if (Math.abs(this.A) > this.findHt) {
		this.D = this.A > 0 ? this.targetY - this.findHt : this.targetY + this.findHt
		this.A = this.A > 0 ? this.findHt : -this.findHt
	} else {
		this.D = this.currentY
	}
}
function animator() {
	var now = new Date()
	var newY = this.A * Math.sin( this.B * ( now.getTime() - this.C ) ) + this.D
	newY = Math.round(newY);
	if (( this.A > 0 && newY > this.currentY ) || ( this.A < 0 && newY < this.currentY )) {
		if ( ie4 )floatLayer.style.pixelTop = newY
		if ( ns4 )document.floatLayer.top = newY
		if ( ns6 )document.getElementById('floatLayer').style.top = newY + "px"
	}
		if ( ie4 ){floatLayer.style.pixelRight = Math.round(this.scrollRight);}
		if ( ns4 ){document.floatLayer.right = Math.round(this.scrollRight);}
		if ( ns6 ){document.getElementById('floatLayer').style.right = Math.round(this.scrollRight) + "px";}
}
