	
var IE = getInternetExplorerVersion();
var leftAdDirection = 30;
if( IE > 0 ) leftAdDirection = 95;
var leftAdFrom = -720;
var leftAdTo = -10;
var leftAdPosition = leftAdFrom;

function leftAdBar(affp, y, url){
	if(!affp) affp = "QqKD3P";
	if(!y) y = 80;
	if(!url) url = "slidingAd.html";
	
	var slidingDiv = document.createElement("DIV");			
	var leftAdBar = '<div id="leftAdBar" style="position:fixed;top:' + y + 
	'px;left:-720px;width:750px;height:360px;text-align:left;z-index:23;-moz-border-radius:8px;-webkit-border-radius:8px;filter:alpha(opacity=97);opacity:0.97;"></div>';
	
	slidingDiv.innerHTML = leftAdBar;
	if(!document.getElementById('leftAdBar')) document.body.appendChild(slidingDiv);
	
	
	document.getElementById('leftAdBar').innerHTML = 
	'<table border="0" cellpadding="0" cellspacing="0" width="100%" height="360">' +
	'<tr valign="top"><td width="100%" height="100%" align="right">' +
	'<iframe frameborder="0" width="97%" height="95%" scrolling="no" style="position:relative;top:8px;left:3px;" src="' + 
	url + '?affp=' + affp + '"></iframe>' +
	'<td align="right"' +
	'<a href="#" onClick="slideLeftAd();return false;" style=" text-decoration:none;">' + 
	' <img id="leftAdSwitch" src="./images/leftAd.png" border="0" title="Apply Here" style="padding:3px;cursor:pointer;position:relative;top:7px;left:-3px;"></a>'
	'</table>';
}

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

function slideLeftAd(){
	if(leftAdDirection > 0){
		if(leftAdPosition < leftAdTo){
			document.getElementById('leftAdBar').style.left = leftAdPosition + "px";
			setTimeout('slideLeftAd()', 1);	
			leftAdPosition += leftAdDirection;
		}
		else{
			leftAdDirection *= -1;
			document.getElementById('leftAdSwitch').src = "./images/close.png";
		}
	}else{
		if(leftAdPosition >= leftAdFrom){
			document.getElementById('leftAdBar').style.left = leftAdPosition + "px";
			setTimeout('slideLeftAd()', 1);	
			leftAdPosition += leftAdDirection;
			document.getElementById('leftAdSwitch').src = "./images/leftAd.png";
		}
		else{
			leftAdDirection *= -1;
		}
	}
}

