

  // Funny text script by Bart Jellema -->

/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  	xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  	try {
    		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  	} catch (e2) {
    		xmlHttp = false;
  	}
}
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != "undefined") {
  xmlHttp = new XMLHttpRequest();
}

function showmain(title,content){
        showmaincontent(title,content);
	}

function showmaincontent(title,content){ 

var url = "/Template/includes/"+content+".asp?idcontent="+title;
  	xmlHttp.open("GET", url, true);
	document.getElementById('content').innerHTML="<p class='subMenu'>Loading...</p>";
  	xmlHttp.onreadystatechange = updateArticle;
  	xmlHttp.send(null);
}

function updateArticle() {
  	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			var responsetext="<div id='content'>"+xmlHttp.responseText+"</div>";
                document.getElementById('main_main').innerHTML=responsetext;
            } else {
                alert('There was a problem with the request.');
            }
  	}
}


function flushcart(){ 
var url = "/Template/includes/login.asp?action=flush";
 	xmlHttp.open("GET", url, true);
 	xmlHttp.onreadystatechange = updateflushcart;
 	xmlHttp.send(null);
}

function updateflushcart() {
  	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			    opener.document.getElementById('sign').innerHTML=xmlHttp.responseText;
            } else {
                alert('There was a problem with the request.');
            }
  	}
}

function usercenter(title){ 

var url = "/Template/includes/server.asp?action="+title;
  	xmlHttp.open("GET", url, true);
	document.getElementById('content').innerHTML="<p class='subMenu'>Loading...</p>";
  	xmlHttp.onreadystatechange = updateusercenter;
  	xmlHttp.send(null);
}

function updateusercenter() {
  	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
                document.getElementById('content').innerHTML=xmlHttp.responseText;
            } else {
                alert('There was a problem with the request.');
            }
  	}
}

function orderexp(title){ 

var url = "/Template/includes/orderexp.asp?action="+title;
  	xmlHttp.open("GET", url, true);
	document.getElementById('orderlist').innerHTML="<p class='subMenu'>Loading...</p>";
  	xmlHttp.onreadystatechange = updateorderexp;
  	xmlHttp.send(null);
}

function updateorderexp() {
  	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
                document.getElementById('orderlist').innerHTML=xmlHttp.responseText;
            } else {
                alert('There was a problem with the request.');
            }
  	}
}

function showbook(title){ 

var url = "/Template/includes/showbook.asp?page="+title;
  	xmlHttp.open("GET", url, true);
	document.getElementById('showbook').innerHTML="<p class='subMenu'>Loading...</p>";
  	xmlHttp.onreadystatechange = updateshowbook;
  	xmlHttp.send(null);
}

function updateshowbook() {
  	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
                document.getElementById('showbook').innerHTML=xmlHttp.responseText;
            } else {
                alert('There was a problem with the request.');
            }
  	}
}

function favshow(title){ 

var url = "/Template/includes/favshow.asp?page="+title;
  	xmlHttp.open("GET", url, true);
	document.getElementById('favshow').innerHTML="<p class='subMenu'>Loading...</p>";
  	xmlHttp.onreadystatechange = updateshowbook;
  	xmlHttp.send(null);
}

function updateshowbook() {
  	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
                document.getElementById('favshow').innerHTML=xmlHttp.responseText;
            } else {
                alert('There was a problem with the request.');
            }
  	}
}

function favdel(title,fav_id){ 

var url = "/Template/includes/favshow.asp?page="+title+"&fav_id="+fav_id+"&action=del";
  	xmlHttp.open("GET", url, true);
	document.getElementById('favshow').innerHTML="<p class='subMenu'>Loading...</p>";
  	xmlHttp.onreadystatechange = updateshowbook;
  	xmlHttp.send(null);
}

function updateshowbook() {
  	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
                document.getElementById('favshow').innerHTML=xmlHttp.responseText;
            } else {
                alert('There was a problem with the request.');
            }
  	}
}

function orderdel(title){ 

var url = "/Template/includes/orderexp.asp?action="+title;
  	xmlHttp.open("GET", url, true);
	//window.opener.document.getElementById('orderlist').innerHTML="<p class='subMenu'>Loading...</p>";
  	xmlHttp.onreadystatechange = updateorderdel;
  	xmlHttp.send(null);
}

function updateorderdel() {
  	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			//alert(xmlHttp.responseText);
                window.opener.document.getElementById('orderlist').innerHTML=xmlHttp.responseText;
            } else {
                alert('There was a problem with the request.');
            }
  	}
}

function show_cart(title,num){ 

var url = "/ORDER/ajaxshop.asp?id="+title+"&num="+num+"";
  xmlHttp.open("GET", url, true);
	document.getElementById('show_cartgoods').innerHTML="<p class='subMenu'>Loading...</p>";
 	xmlHttp.onreadystatechange = updateshow_cart;
  	xmlHttp.send(null);
}

function updateshow_cart() {
  	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			//alert(xmlHttp.responseText);
               document.getElementById('show_cartgoods').innerHTML=xmlHttp.responseText;
            } else {
                alert('There was a problem with the request.');
            }
  	}
}

function login_cart(){ 
var url = "/Template/includes/login.asp?action=flush";
  	xmlHttp.open("GET", url, true);
	document.getElementById('sign').innerHTML="<p class='subMenu'>Loading...</p>";
  	xmlHttp.onreadystatechange = updatelogin_cart;
  	xmlHttp.send(null);
}

function updatelogin_cart() {
  	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
                document.getElementById('sign').innerHTML=xmlHttp.responseText;
            } else {
                alert('There was a problem with the request.');
            }
  	}
}

function shopopen(id){
	window.open('/order/shop.asp?ProdId='+id,'blank_','scrollbars=yes,resizable=no,width=660,height=450,left=150')
	}
function favopen(id){
	window.open('/order/fav.asp?ProdId='+id,'blank_','scrollbars=yes,resizable=no,width=650,height=450,left=150')
	}
function image(id,name){
window.open('/html/image.asp?id='+id+'&name='+name,'blank_','scrollbars=yes,resizable=yes,width=1,height=1,left=150');
	}
	
function favToCart(id){
	show_cart(id,1);
	showFloat();
	}
function addToCart(id){
	num=document.all.number.value;
	show_cart(id,num);
	showFloat();
	}
function addToCartp(id,heig){
	num=1;
	heig=460+heig*250+"px";
	document.getElementById("divLogin").style.top=heig; 
	show_cart(id,num);
	showFloat();
	}
function ShowNo()                        //隐藏两个层 
        { 
            document.getElementById("doing").style.display="none"; 
            document.getElementById("divLogin").style.display="none"; 
        } 
        function $(id)        
        { 
            return (document.getElementById) ? document.getElementById(id) : document.all[id] ; 
        } 
        function showFloat()                    //根据屏幕的大小显示两个层 
        { 
            var range = getRange(); 
            $('doing').style.width = range.width + "px"; 
            $('doing').style.height = range.height + "px"; 
            $('doing').style.display = "block"; 
            document.getElementById("divLogin").style.display=""; 
        } 
        function getRange()                      //得到屏幕的大小 
        { 
              var top    = document.body.scrollTop; 
              var left    = document.body.scrollLeft; 
              var height = document.body.clientHeight; 
              var width  = document.body.clientWidth; 

              if (top==0 && left==0 && height==0 && width==0) 
              { 
                top    = document.documentElement.scrollTop; 
                left    = document.documentElement.scrollLeft; 
                height = document.documentElement.clientHeight; 
                width  = document.documentElement.clientWidth; 
              } 
              return {top:top ,left:left ,height:height ,width:width } ; 
        } 



