<%@ control language="C#" autoeventwireup="true" inherits="Controls_PiaoFu, Huibo.Net" %>
<div id="img1" style="Z-INDEX: 100; LEFT: 2px; WIDTH: 59px; POSITION: absolute; TOP: 43px; HEIGHT: 61px;
 visibility: visible;">
 <a href="http://www.codefans.net" id="href_Url" target="_blank">
 <img id="img_Path" src="/jscss/demoimg/200908/pic.gif" width="200" height="200" border="0" onmouseover="MouseOver();" onmouseout="MouseOut();">
 </a>
 </div>
<script type="text/javascript">
var xPos = 300;
var yPos = 200; 
var step = 1;
var delay = 30; 
var height1 = 0;
var Hoffset = 0;
var Woffset =0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
img1.style.top = yPos;
function changePos() 
{
	width1 = document.body.clientWidth;
	height1 = document.body.clientHeight;
	Hoffset = img1.offsetHeight;
	Woffset = img1.offsetWidth;
	img1.style.left = xPos + document.body.scrollLeft;
	img1.style.top = yPos + document.body.scrollTop;
	if (yon) 
		{yPos = yPos + step;}
	else 
		{yPos = yPos - step;}
	if (yPos < 0) 
		{yon = 1;yPos = 0;}
	if (yPos >= (height1 - Hoffset)) 
		{yon = 0;yPos = (height1 - Hoffset);}
	if (xon) 
		{xPos = xPos + step;}
	else 
		{xPos = xPos - step;}
	if (xPos < 0) 
		{xon = 1;xPos = 0;}
	if (xPos >= (width1 - Woffset)) 
		{xon = 0;xPos = (width1 - Woffset);}
}
	
	function start()
	{
	 	img1.visibility = "visible";
		interval = setInterval('changePos()', delay);
	}
	function pause_resume() 
	{
	    var xmlHttp1=null;
        if(window.ActiveXObject) {
            xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        } else {
            xmlHttp1 = new XMLHttpRequest();
        }
        var url ="GetAd.ashx?type=piaofu";
        xmlHttp1.open('GET', url, false);
        xmlHttp1.send(null);
        
        if (4 == xmlHttp1.readyState) {
            if (200 == xmlHttp1.status) {
                var response = xmlHttp1.responseText;
                
                if (response == '') {
                    document.getElementById("img_Path").style.display="none";
                    clearInterval(interval);
			        pause = false;
                } else{
		            var arrylist=response.split('!@#$');
		            var piaofupic=arrylist[0];
		            var piaofuurl=arrylist[1];
		            document.getElementById("img_Path").setAttribute("src",piaofupic,true);
		            document.getElementById("href_Url").setAttribute("href",piaofuurl,true);
                }
            }
        }
        xmlHttp1=null;
        
		if(pause) 
		{
			clearInterval(interval);
			pause = false;}
		else 
		{
			interval = setInterval('changePos()',delay);
			pause = true; 
		}
	}
	start();
	function MouseOver(){
	    clearInterval(interval);
	    pause = false;
	}
	function MouseOut(){
	    interval = setInterval('changePos()',delay);
	    pause = true; 
	}

</script>
<script type="text/javascript">
//    window.onload=function(){
//    var xmlHttp1=null;
//    if(window.ActiveXObject) {
//        xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
//    } else {
//        xmlHttp1 = new XMLHttpRequest();
//    }
//    var url ="GetAd.ashx?type=piaofu";
//    xmlHttp1.open('GET', url, false);
//    xmlHttp1.send(null);
//    
//    if (4 == xmlHttp1.readyState) {
//        if (200 == xmlHttp1.status) {
//            var response = xmlHttp1.responseText;
//            if (response == '') {
//                
//            } else{
//		        var arrylist=response.split('!@#$');
//		        var piaofupic=arrylist[0];
//		        var piaofuurl=arrylist[1];
//		        document.getElementById("img_Path").setAttribute("src",piaofupic,true);
//		        document.getElementById("href_Url").setAttribute("href",piaofuurl,true);
//            }
//        }
//    }
//    xmlHttp1=null;
//}
</script>