function loadImages() {
	transparent_id="transparent_div";
if (document.getElementById) {  // DOM3 = IE5, NS6
document.getElementById('hidepage').style.visibility = 'hidden';
}
else {
if (document.layers) {  // Netscape 4
document.hidepage.visibility = 'hidden';

}
else {  // IE 4
document.all.hidepage.style.visibility = 'hidden';
      }
   }
}
  var lastColor; 
    function GR_changeBackColor(row, highlight) 
    { 
        if (highlight) 
        { 
            //row.style.cursor = "hand"; 
            lastColor = row.style.backgroundColor; 
            row.style.backgroundColor = 'Wheat'; 
            row.style.border='gray 1px inset';            
        }
        else 
            row.style.backgroundColor = lastColor; 
    } 
    function GR_Onclick(URL)
    {
        location.href=URL;
    }
    function scrolls(dir,id,total,clicks)
	{
		cur=document.getElementById(id+'_current_id').value;
		//alert(cur)
		if(total>1)
		{
			if(0<cur<=total)
			document.getElementById(id+'_'+cur).style.display='none';
			if(dir==1)
			{
				next=eval(cur)+1;
				if(next<=total)
				{
					if(next==total)
					{
						document.getElementById(id+'_imgUp').style.display='none';
						document.getElementById(id+'_imgDown').style.display='';
					}
					else
					{
						document.getElementById(id+'_imgDown').style.display=''
						document.getElementById(id+'_imgUp').style.display='';
					}	
					
					document.getElementById(id+'_'+next).style.display='';
					document.getElementById(id+'_current_id').value=next;
					if(!clicks)
					window.setTimeout("scrolls(1,'"+id+"',"+total+",false)",10000);
				}
				else window.setTimeout("scrolls(-1,'"+id+"',"+total+",false)",0);
			}	
			if(dir==-1)
			{
				pre=eval(cur)-1;
				if(pre>0)
				{
					if(pre==1)
					{
					    document.getElementById(id + '_1').style.display='';
						document.getElementById(id+'_imgUp').style.display='';
						document.getElementById(id+'_imgDown').style.display='none';
					}
					else
					{
					    document.getElementById(id + '_1').style.display='none';
						document.getElementById(id+'_imgDown').style.display=''
						document.getElementById(id+'_imgUp').style.display='';
					}	
					document.getElementById(id+'_'+pre).style.display='';
					document.getElementById(id+'_current_id').value=pre;
					if(!clicks)
					window.setTimeout("scrolls(-1,'"+id+"',"+total+",false)",10000);
				}
				else 	window.setTimeout("scrolls(1,'"+id+"',"+total+",false)",0);
			}
		}
	}
	
        function Poll(Url)
        {         

        _input=document.getElementsByTagName('input');        
        for(var i=0;i<_input.length;i++)
        {       
        if(_input[i].type=='radio')
        {        
            if(_input[i].id.toString().indexOf('option_')>=0)
            {
                if(_input[i].checked==true)
                {
                 var leftPos = (screen.availWidth-430) / 2;
	            var topPos = (screen.availHeight-350) / 2;	            
                window.open(Url + 'ViewVote.aspx?act=vote&VoteDetailID=' + _input[i].id.toString().substring(7,_input[i].id.toString().length),'','width=430,height=350,scrollbars=yes,resizable=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
                //alert(_input[i].id.toString().substring(7,_input[i].id.toString().length));
                //window.showModalDialog("/Auction/ViewVote.aspx?VoteDetailID=" + _input[i].id.toString().substring(7,_input[i].id.toString().length),window,"dialogWidth:400px;dialogHeight:300px;edge:Raised;center:Yes;help:No;Resizable:Yes;Maximize:Yes;");
                }
            }            
        }
        }    
       
        }
        
       

    function pagingItem(page,totalpages,place)
	{  
		if (totalpages>1)
		{	
			var current_page = page;
			var paging = '';
			for(var i=1; i<=totalpages; i++)
			{
				
				if (i==current_page)
				{
					document.getElementById(place+i).style.display='';
					paging = paging + '<a href="#PageIndex" onclick="return false;"><span style="color:red; font-weight:bold" >  ' + i + '</span></a>';
					if(current_page==totalpages)num=1;
					else num=current_page+1;
					
				}	
				else
				{
					document.getElementById(place+i).style.display='none';
					paging = paging + '<a href="#PageIndex" onclick="javascript:pagingItem(' + i + ', ' + totalpages + ',\''+place+'\')">  ' + i + "</a>";
				}	
			}
			paging = paging +'</div></div>';
			document.getElementById(place+'_paging').innerHTML = paging;
			
		}
		else document.getElementById(place+'_paging').innerHTML = '';		
	}

function ajaxLoader(url) {   
  if (document.getElementById) { 
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); 
  } 
  if (x) {   
  
    x.onreadystatechange = function() {     
      if (x.readyState == 4 && x.status == 200) {                   
      location.href=url;
        //el = document.getElementById(id); 
        
        //el.innerHTML = x.responseText; 
      } 
    } 
    x.open("GET", url, true); 
    x.send(null); 
  } 
}       
function running()
{
		id = "hidepage";
		var elem = document.getElementById(id);
		if (elem && elem.style.visibility != 'hidden') {			
			if(document.all) 
			{
							
				document.all(id).style.pixelLeft = 10;
				document.all(id).style.pixelTop  =document.body.scrollTop + 32;
			} 
			else if((document.getElementById) && (!document.all)) {		
				
					document.getElementById(id).style.left =10 +"px";
					document.getElementById(id).style.top  = self.pageYOffset + 32 + "px";										
				}
				setTimeout('running()', 100);
		}
}

function validateEmail(email) {
    var _email=document.getElementById(email);
    if (!_email.value) {
        return true;
    }
    var re_mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/;
    if (!re_mail.test(_email.value)) {       
        _email.focus();
        _email.select();
        return false;
    }
    return true;
}
function SendRequest(url, params,dk,cat_id,pageindex)
{      
   var pageUrl = url + "?param=" + encodeURIComponent(params) + "&dk=" + dk + "&cat_id=" + cat_id + "&pageindex=" + pageindex;     
   try {
       xmlRequest = new XMLHttpRequest();
   }
   catch(e) {
      try {
          xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e) { }
   }       
   xmlRequest.onreadystatechange=function()
   {
   var ImgLoad=document.getElementById("LoadImg");  
    if(xmlRequest.readyState==4 && xmlRequest.status==200)
    {
     if(typeof(ImgLoad)!="undefined")
        {       
            if(ImgLoad.style.display=="block")
            {                        
            ImgLoad.style.display="none";
            }         
        }   
    }
    else
    {
    if(typeof(ImgLoad)!="undefined")
        {       
            if(ImgLoad.style.display=="none")
            {                        
            ImgLoad.style.display="block";
            }         
        }   
    }   
    }      
   xmlRequest.open("GET", pageUrl, false);   
   xmlRequest.setRequestHeader("Content-Type",
                               "application/x-www-form-urlencoded");
   xmlRequest.send(null);
   return xmlRequest;   
}
//function SendRequest(url, params,dk,cat_id,pageindex)
//{      
//   var pageUrl = url + "?param=" + encodeURIComponent(params) + "&dk=" + dk + "&cat_id=" + cat_id + "&pageindex=" + pageindex;     
//   try {
//       xmlRequest = new XMLHttpRequest();
//   }
//   catch(e) {
//      try {
//          xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
//      }
//      catch(e) { }
//   }       
//   xmlRequest.onreadystatechange=function()
//   {
//   var ImgLoad=document.getElementById("LoadImg");  
//    if(xmlRequest.readyState==4 && xmlRequest.status==200)
//    {
//     if(typeof(ImgLoad)!="undefined")
//        {       
//            if(ImgLoad.style.display=="block")
//            {                        
//            ImgLoad.style.display="none";
//            }         
//        }   
//    }
//    else
//    {
//    if(typeof(ImgLoad)!="undefined")
//        {       
//            if(ImgLoad.style.display=="none")
//            {                        
//            ImgLoad.style.display="block";
//            }         
//        }   
//    }   
//    }      
//   xmlRequest.open("GET", pageUrl, false);   
//   xmlRequest.setRequestHeader("Content-Type",
//                               "application/x-www-form-urlencoded");
//   xmlRequest.send(null);
//   return xmlRequest;   
//}
//function onCallback()
//{
// var label=document.getElementById("spanmsg");
//if(xmlRequest.readyState==4)
//{
//if(xmlRequest.status==200)
//{   
// label.innerHTML=xml.responseText; 
//}
//}
//else
//{
// label.innerHTML=xml.responseText; 
//}
//}
function onCallback()
{
var ImgLoad=document.getElementById("LoadImg");  
if(xmlRequest.readyState<4)
{
    if(typeof(ImgLoad)!="undefined")
    {   
        if( ImgLoad.style.display=="none")
        {                      
        ImgLoad.style.display="block";        
        }              
    } 
     
}
else if(xmlRequest.readyState==4)
{
if(xmlRequest.status==200)
{   
    if(typeof(ImgLoad)!="undefined")
    {       
        if(ImgLoad.style.display=="block")
        {                        
        ImgLoad.style.display="none";
        }         
    }   
}
}
else
{

}
}
//xmlRequest.onreadystatechange=function()
//{
//    var spanimg=document.getElementById("spanmsg");
//        if(xmlRequest.readystate<4)
//        {        
//        spanimg.innerHTML="<img src=\"/Auction/Images/loading.gif\" />";
//        }
//        else
//        {
//        spanimg.style.display="none";   
//        }   
// }  
function CheckAllByValue(Value,strKey)
{    
    _input=document.getElementsByTagName('input');
    for(i=0;i<_input.length;i++)
    {
        if(_input[i].type=='checkbox')
        {
            var chkID=_input[i].id.toString();
            if(typeof(strKey)=='undefined'||(typeof(strKey)!='undefined' && chkID.indexOf(strKey)>=0))
            {
                if(_input[i].checked != Value) _input[i].checked=Value;
            }
        }
    }
}
function ShowWindow(sUrl,w,h,resize)
{
	var winX = 0;
	var winY = 0;
	if (parseInt(navigator.appVersion) >= 4)
	{
		winX = (screen.availWidth - w)*.5;
		winY = (screen.availHeight - h)*.5;
	}
	popupLoadnWin=window.open(sUrl,'popupLoadnWin','scrollbars,resizable=' + resize + ',status=yes, width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
	return popupLoadnWin;
}
function flashWrite(url,w,h){

    var _height="",_width="";
    if (typeof(h)!='undefined')
        _height=" height=\"" +  h + "\" "; 
    if (typeof(w)!='undefined')
        _width=" width=\"" +  w + "\" "; 
    var flashStr=
    "<object classid=\"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000\" style=\"cursor:hand\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\"" + _height + _width + ">"+
    "<param name=\"movie\" value=\"" + url + "\">" +
    "<param name=\"quality\" value=\"high\">" +
    "<param name=\"wmode\" value=\"transparent\">" +
    "<param name=\"allowScriptAccess\" value=\"always\" />" +
    "<embed src=\"" + url + "\" onclick=\"" + url + "\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"" + _height + _width + ">" +
    "</object>";
    return flashStr;
}
function ShowBanners(arrAdv, strPath, cellId, tableId)
{
    var objLeft=document.getElementById(cellId);    
    if (arrAdv.length>0)
    {
        var _html='';
        for(i=0;i<arrAdv.length;i++)
        {
            var arrSize=new Array("","");
            if(arrAdv[i][3]!='')
            {
                if(arrAdv[i][3].indexOf('x')>0)
                    arrSize=arrAdv[i][3].split('x');
                else if(arrAdv[i][3].indexOf('X')>0)
                    arrSize=arrAdv[i][3].split('X');
            }
           var strImgUrl=strPath + arrAdv[i][1];
           if (arrAdv[i][1].toString().toLowerCase().indexOf('.swf')==-1) 
           {
             var strSize="";
             if(arrSize[0]!="")strSize = " width='" + arrSize[0] + "'" + " height='" + arrSize[1] + "'";
            _html += "<div style=\"padding-bottom:2px;\"><a href='" + arrAdv[i][2] + "' target=\"" + (arrAdv[i][7]==1?"_self":"_blank") + "\"><img " + strSize + " style=\"cursor:hand\" alt='' src='" + strImgUrl + "' border=\"0\"/></a></div>";
           }
           else
           {
            if(arrSize[0]!="")
                _html+="<div style=\"padding-bottom:2px;\"><a style=\"cursor:hand\" href=\"" + arrAdv[i][2] + "\" target=\"" + (arrAdv[i][7]==1?"_self":"_blank") + "\">" + flashWrite(strImgUrl,arrSize[0],arrSize[1]) + "</a></div>";
            else
                _html+="<div style=\"padding-bottom:2px;\"><a style=\"cursor:hand\" href=\"" + arrAdv[i][2] + "\" target=\"" + (arrAdv[i][7]==1?"_self":"_blank") + "\">" + flashWrite(strImgUrl) + "</a></div>";
           }
        }
        objLeft.style.display='block';
        objLeft.innerHTML=_html;
    }
    else document.getElementById(tableId).style.display="none";
}
function ButtonClick(btnSubmit)
{
    if(event.keyCode==13)
    {
        document.getElementById(btnSubmit).click();
        return false;
    }
    //return true;
}