//scroller's width
var i_width = 350;
//scroller's height
var i_height = 160;
// start next back params and functions
//-- Begin Scroller's Parameters and messages -->
//scroller's speed 
var i_scroll_speed = 77;
var i_restart = i_scroll_speed;
// html built for the display
var s_html = '';
//scroller's pause 
var i_pause = 4000;
//timer for next and previous funtions
var t;
// allow one forward or backwards
var b_allow = true;
//scroller's background
sbcolor="#ffffff";
var i_image = 0;
var i_max = 3;
var s_size = ' width="' + i_width + 'px" height="' + i_height + 'px"';
var s_size2 = ' width="' + i_width + '" height="' + i_height + '"';

// messages on left of header

var aMsg = new Array(4);
aMsg[0] = '"I WANT TO GENERATE MORE LEADS<br /><span class="header">&nbsp;&nbsp;&nbsp; FOR THE SALES TEAM!"</span><p align="center">Email Marketing & WebCast Event Management</p>';
aMsg[1] = '"I WANT TO <br /><span class="header">&nbsp;&nbsp;&nbsp; CLOSE MORE DEALS!"</span><p align="center" class="style14">Close more deals with a simple to use CRM Opportunity Manager.</p>';
aMsg[2] = '"I WANT TO <br /><span class="header">&nbsp;&nbsp;&nbsp; GROW KEY ACCOUNTS!"</span><p align="center" class="style14">Cross Sell and Up Sell solutions to your existing customer base.</p>';
aMsg[3] = '"I WANT TO <br /><span class="header">&nbsp;&nbsp;&nbsp; CLOSE MORE DEALS!"</span><p align="center" class="style14">Close more deals with a simple to use CRM Opportunity Manager.</p>';

// images and links - auto scroll
var a_img = new Array();
a_img[0] = '/wmf/images/slide1.gif';
a_img[1] = '/wmf/images/slide2.gif';
a_img[2] = '/wmf/images/slide3.gif';
a_img[3] = '/wmf/images/slide4.gif';

var a_link = new Array();
a_link[0] = '/wmf/index.cfm/';
a_link[1] = '/wmf/index.cfm/';
a_link[2] = '/wmf/index.cfm/';
a_link[3] = '/wmf/index.cfm/';
// end data - auto scroll

function changeMsg(i) {

	var i_image_temp;
	var oMessage = document.getElementById('oMsg');
	if (i != 0) {
		if (b_allow) {
			i_image += i;
			if (i_image > i_max) i_image_temp = 0;
			else if (i_image < 0) i_image_temp = i_max;
			else i_image_temp = i_image;
			oMessage.innerHTML = aMsg[i_image_temp];
			i_image = i_image_temp - 1;
			if (i_image > i_max) i_image = 0;
			else if (i_image < 0) i_image = i_max;
			b_allow = false;
		}
	} 
	else {
		oMessage.innerHTML = aMsg[i_image];
		b_allow = true;
	}
}
// end start next back params and functions

//When no preloading, use below the actual image path instead of '+preload...+';
var a_ads = new Array();
var s_begin = '<nobr><a href="';
var s_middle = '"><img border="0" src=';
var s_end = s_size + '></a></nobr>';
//alt and title tags can be added - must add associated arrays
a_ads[0] = s_begin + a_link[0] + s_middle + a_img[0] + s_end;
a_ads[1] = s_begin + a_link[1] + s_middle + a_img[1] + s_end;
a_ads[2] = s_begin + a_link[2] + s_middle + a_img[2] + s_end;
a_ads[3] = s_begin + a_link[3] + s_middle + a_img[3] + s_end;
//a_ads[4] = s_begin + a_link[4] + s_middle + a_img[4] + s_end;
//-- end Parameters and message -->

//-- begin: Scroller's Algorithm -->
var gekso = 0; 
if(navigator.product&&navigator.product=='Gecko') {
	var agt = navigator.userAgent.toLowerCase(); 
	var rvStart = agt.indexOf('rv:'); 
	var rvEnd = agt.indexOf(')', rvStart); 
	var check15 = agt.substring(rvStart+3, rvEnd); 
	if (parseFloat(check15) < 1.8) gekso = 1; 
} 
var operbr = 0; 
operbr=navigator.userAgent.toLowerCase().indexOf('opera');

function goup() {
	if(i_scroll_speed != i_restart * 16) i_scroll_speed = i_scroll_speed * 2;
	i_restart = i_scroll_speed; 
}

function start() {
	changeMsg(0); // change message
	if(document.getElementById) {
		ns6div = document.getElementById('iens6div'); 
		if(operbr!=-1) operdiv = document.getElementById('operaslider');
		ns6div.style.left = i_width + 'px'; 
		ns6div.innerHTML = a_ads[i_image]; 
		sizeup = ns6div.offsetWidth; 
		if (operbr != -1 && sizeup == i_width) {
			operdiv.innerHTML = a_ads[i_image]; 
			sizeup = operdiv.offsetWidth; 
		}
		ns6scroll();
	} 
	else if(document.layers) {
		ns4layer = document.ns4div.document.ns4div1;
		ns4layer.left = i_width; 
		ns4layer.document.write(a_ads[i_image]); 
		ns4layer.document.close(); 
		sizeup = ns4layer.document.width; ns4scroll();
	} 
	else if(document.all) { 	
		iediv = iens6div;
		iediv.style.pixelLeft = i_width + 'px';
		iediv.innerHTML = a_ads[i_image];
		sizeup = iediv.offsetWidth;iescroll(); 
	}
}

function stopAutoDisplay() {
	//clearTimeout(t);
}

function iescroll() { 
	if(iediv.style.pixelLeft > 0 && iediv.style.pixelLeft <= i_scroll_speed) { 
		iediv.style.pixelLeft = 0; 
		t = setTimeout('iescroll()',i_pause); 
	} 
	else if (iediv.style.pixelLeft >= sizeup * -1) {
		iediv.style.pixelLeft -= i_scroll_speed + 'px'; 
		t = setTimeout('iescroll()',100); 
	} 
	else { 
		if (i_image == a_ads.length - 1) i_image = 0; 
		else i_image++; 
		changeMsg(0); // change message
		iediv.style.pixelLeft = i_width + 'px'; 
		iediv.innerHTML = a_ads[i_image]; 
		sizeup = iediv.offsetWidth; 
		iescroll(); 
	} 
}

function ns4scroll() {
	if (ns4layer.left > 0 && ns4layer.left <= i_scroll_speed) {
		ns4layer.left = 0; 
		t = setTimeout('ns4scroll()',i_pause); 
	} 
	else if(ns4layer.left >= sizeup * -1) {
		ns4layer.left -= i_scroll_speed; 
		t = setTimeout('ns4scroll()',100); 
	} 
	else { 
		if (i_image == a_ads.length - 1) i_image = 0;
		else i_image++;
		changeMsg(0); // change message
		ns4layer.left = i_width; 
		ns4layer.document.write(a_ads[i_image]); 
		ns4layer.document.close(); 
		sizeup = ns4layer.document.width; 
		ns4scroll(); 
	}
}

function ns6scroll() {
	if (parseInt(ns6div.style.left) > 0 && parseInt(ns6div.style.left) <= i_scroll_speed) {
		ns6div.style.left = 0; 
		t = setTimeout('ns6scroll()',i_pause); 
	} 
	else if (parseInt(ns6div.style.left) >= sizeup * -1) {
		ns6div.style.left = parseInt(ns6div.style.left) - i_scroll_speed + 'px';
		t = setTimeout('ns6scroll()',100);
	}
	else { 
		if(i_image == a_ads.length - 1) i_image = 0;
		else i_image++;
		changeMsg(0); // change message
		ns6div.style.left = i_width + 'px';
		ns6div.innerHTML = a_ads[i_image];
		sizeup = ns6div.offsetWidth; 
		if (operbr != -1 && sizeup == i_width) { 
			operdiv.innerHTML = a_ads[i_image]; 
			sizeup = operdiv.offsetWidth; 
		}
		ns6scroll(); 
	}
}
// build the html - this can't be displayed twice
if (document.layers) {
	s_html = s_html + '<ilayer id="ns4div"' + s_size2 + '" bgcolor=' + sbcolor + '><layer id="ns4div1"' + s_size2 + '" onmouseover="i_scroll_speed=0;" onmouseout="i_scroll_speed=i_restart"></layer></ilayer>';
}
if(document.getElementById||document.all) {
	s_html = s_html + '<div style="position:relative;overflow:hidden;width:' + i_width + 'px;height:' + i_height + 'px;clip:rect(0 ' + i_width + 'px ' + i_height + 'px 0);background-color:' + sbcolor + ';" onmouseover="i_scroll_speed=0;" onmouseout="i_scroll_speed=i_restart">'; 
	if (gekso == 0 && operbr == -1) s_html = s_html + '<div id="iens6div" style="position:absolute;height:' + i_height + 'px;">';
	else s_html = s_html + '<div id="iens6div" style="position:relative;height:' + i_height + 'px;"></div><div id="operaslider" style="position:absolute;visibility:hidden;">';
	s_html = s_html + '</div></div>';
}
//-- end Algorithm -->
