

function hideLayer()
{	
	var layer = document.getElementById("popImageLayer");
	layer.style.visibility='hidden';
}
function dispear(){
	var layer = document.getElementById("popImageLayer");
	if ((layer.style.width>0)&& (layer.style.height>0)){
		layer.style.width-=1;
		layer.style.height-=1;
	}
	else {
		layer.style.visibility='hidden';
		if (window.interval)
		clearInterval(interval);
	}
}

function popImage(id,obj,img,href) 
{ 
	var layer = document.getElementById("popImageLayer");
	var t=obj.offsetTop;
	var l=obj.offsetLeft;
	while(obj=obj.offsetParent){
		t+=obj.offsetTop;
		l+=obj.offsetLeft;
	}
	var content = "<table border=0 width=180 height=180><tr><td align='center' valign='middle'>\n"+"<a href='book.asp?id="+id+"' target=_blank><IMG src='"+img+"' onload='DrawImage(this,500,375);'onMouseOut='low(this);hideLayer();' onMouseOver=high(this) style='FILTER: alpha(opacity=10)' border=0></a></td></tr></table>"; // onClick='hideLayer();'

			layer.innerHTML=content;
			layer.style.left =l + 35 -90;
			layer.style.top = t+35-90;
			layer.style.visibility='visible';
} 
function moveToMouseLoc(e) 
{ 
	var layer = document.getElementById("popImageLayer");
	var offsetX = -5; 
	var offsetY = -5;
	var	 x = event.x + document.body.scrollLeft;
	var	 y = event.y + document.body.scrollTop; 
	layer.style.left = x + offsetX;
	layer.style.top = y + offsetY;
	return true; 
} 


function DrawImage(img,width,height){ 
	if(DrawImage.arguments.length < 1) 
		width=height=70;
	var image=new Image(); 
	image.src=img.src; 
	if(image.width>0 && image.height>0)
	{
	  if(image.width>width)
	  {
	  	rate=image.height/image.width;
	  	newHeight=rate*width;
	  	img.width=width;
	  	img.height=newHeight;
	  } 
	}
	if(img.height>height)
	{
		rate=image.width/image.height;
		newWidth=rate*height;
		img.height=height;
		img.width=newWidth;
	}
}

function DrawImage50(img){ 
	DrawImage(img,10,10);
}

function resetForm(){
	var f=document.frmsearch;
   f.Page.value = 1;
   f.ClassCode.value ='' ;
   f.SortType.value ='' ;		
   f.KeyWord.value='';
   f.Area.value='';
   f.MinPrice.value=f.MaxPrice.value='';
	return false;		
}		
function manualSearch(){
	var f=document.frmsearch;
   f.Page.value = 1;
  // f.ClassCode.value ='' ;
   f.SortType.value ='' ;		
   f.submit();
	return false;		
}
function checkCondition(obj) {
	return true;
}
function selectview(obj)
{
   var f=document.frmsearch;
   if ((obj.selectedIndex>0) && (obj.selectedIndex <7))
   		f.SortType.value = obj.options[obj.selectedIndex].value;
	else if ((obj.selectedIndex>6) && (obj.selectedIndex <10))
   		f.View.value = obj.options[obj.selectedIndex].value;
	else if ((obj.selectedIndex>9) && (obj.selectedIndex <13))
   		f.PageSize.value = obj.options[obj.selectedIndex].value;
   f.submit();
	return false;		
}
function changeLocation(obj){
	var f=document.frmsearch;
   f.Area.value = obj.options[obj.selectedIndex].value;
   f.submit();
	return false;		
}
function changeViewMode(mode){
	var f=document.frmsearch;
   f.View.value = mode;
   f.submit();
	return false;
}
function changePage(page){
	var f=document.frmsearch;
   f.Page.value = page;
   f.submit();
	return false;
}
function changePageSize(pagesize){
	var f=document.frmsearch;
   f.Page.value = 1;
   f.PageSize.value = pagesize;		
   f.submit();
	return false;
}

function changeSortType(type){
	var f=document.frmsearch;
   f.Page.value = 1;		
   f.SortType.value = type;
   f.submit();
	return false;
}
function changeClassCode(code){
	var f=document.frmsearch;
   f.ClassCode.value = code;
   f.Page.value=1;
   f.submit();
	return false;
}

function high(which2){
	theobject=which2;
	highlighting=setInterval("highlightit(theobject)",40);
}
function low(which2){
	clearInterval(highlighting);
	which2.filters.alpha.opacity=40;
}
function highlightit(cur2){
	if (cur2.filters.alpha.opacity<100)
		cur2.filters.alpha.opacity+=5
	else if (window.highlighting)
		clearInterval(highlighting)
}

function delightit(cur2){
	if (cur2.filters.alpha.opacity>5)
		cur2.filters.alpha.opacity-=5;
	else if (window.highlighting)
			clearInterval(highlighting);
}



function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}





function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

