var ie=document.all
var ns6=document.getElementById&&!document.all
function auf(bildertausch,searchtext)
{
 if(bildertausch=="find_dialog")
 {
	 document.getElementById(bildertausch).style.visibility="visible";
	 document.getElementById(bildertausch).style.display="block";
	 document.getElementById('searchsrc').src="search.aspx?searchtext="+searchtext;
		        
 }
}
function movenext(pgno)
{
//alert(pgno);
document.getElementById("startingrecord").value = pgno;
document.Form1.submit();
document.getElementById("startingrecord").value = pgno;

}
function getsearchPage(pgno,searchword,pdfname,site,publication)
{
var sitee="http://www.ezinemart.com/"+site+"/home.aspx";

	window.opener.parent.searchPage(searchword,pgno);
	//window.close();
	var  mode=2;
		var standardview,magnifiedview;
		var search;
		//alert("hello");
		//windowWidth = getWidth();
		//windowHeight = getHeight();
		
		//alert(windowHeight);
		if (document.all)
		{
			//alert("hello2");
			// IE version
				try 
				{
					var xml = new ActiveXObject("Microsoft.XMLHTTP");
					xml.Open( "GET", "SearchInputPage.aspx?searchword=" + searchword + "&pdfname=" + pdfname + "&pageno=" + pgno +"&mode="+mode, false );
					xml.Send()
					rp=xml.responseText;
				}
				catch (e) 
				{
				var xml = new ActiveXObject("MSXML2.XMLHTTP.4.0");
				xml.Open( "GET", "SearchInputPage.aspx?searchword=" + searchword + "&pdfname=" + pdfname + "&pageno=" + pgno+"&mode="+ parent.document.getElementById("mode").value, false );
				xml.Send()
				rp=xml.responseText;
				}
			}
		else
		{
			// Mozilla/Netscrap 6+ version
			
					var xml=new XMLHttpRequest();
					xml.open("GET","SearchInputPage.aspx?searchword=" + searchword + "&pdfname=" + pdfname + "&pageno=" + pgno+"&mode="+ parent.document.getElementById("mode").value,false);
					xml.send(null);
					rp=xml.responseText;
		}
		//search="SearchInputPage.aspx?searchword=" + searchword + "&pdfname=" + pdfname + "&pageno=" + pgno;
		//window.open(search);
					//alert("hello4");
					getSearchCordinate(pgno);
		//mode=parent.document.getElementById("mode").value;
		window.opener.parent.document.getElementById("pgno").value=pgno.toString();
	
		//standardview=parent.document.getElementById("txtstandardviewpath").value ;
		//magnifiedview=parent.document.getElementById("txtMagnifiedViewPath").value;
		//pgno=parseInt(pgno)-1;
	//	alert(pgno);
		if (publication=="current")
		{
			/*if(parseInt(pgno)%2==0)
pgno=parseInt(pgno)-2;
else
pgno=parseInt(pgno)-1;*/
		//window.parent.detail.searchPage(pgno);
		//alert("pub");
		//window.opener.parent.document.getElementById("detail").src="fullimage1.aspx?pgno="+ pgno +" &mode=" + mode + "&Sresolution=" + windowWidth + '&fitparam=' + windowHeight +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth + "&Standardview=" + standardview + "&Magnifiedview=" + magnifiedview+"&search=S";
		
		}
		else
		{
		//alert(site);
		
		var site1=sitee + "?pgno=" + pgno + "&mode=" + mode ;
		window.open(site1);
		}
		
		//changestatus(pgno);
			//alert("hello8");
			
	}
	

var DELAY_AFTER_KEYDOWN = 50;  // in ms (1000 = 1s)
var ALT_KEY = 18;
var SHIFT_X_KEY     = 88;
var PAGE_UP_KEY     = 33;
var PAGE_DOWN_KEY   = 34;
var ARROW_UP_KEY    = 38;
var ARROW_DOWN_KEY  = 40;
var ARROW_LEFT_KEY  = 37;
var ARROW_RIGHT_KEY = 39;
//alert(document.captureEvents(Event.KEYDOWN));
var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;

var current_x = 0; // Know where we are, scrolling around...
var current_y = 0; // Know where we are, scrolling around...

var last_x = 0; // So we remember where we were the last time we moved...
var last_y = 0; // So we remember where we were the last time we moved...

document.onkeydown = handleKeyDown;
window.onscroll    = handleScroll;

if (ns4) {
  document.captureEvents(Event.KEYDOWN);
	
}

function handleKeyDown (e) {

if ((event.keyCode=='122') && window.opener){
window.close('fs');
return false;
}

  var pushed_key="Default";
  if (ie4) {
    pushed_key = event.keyCode;
  } else {
    pushed_key = e.which;
  }
	
  //setTimeout("getScrollPos("+pushed_key+")", DELAY_AFTER_KEYDOWN);
  
}


function handleScroll () {
    current_x = document.body.scrollLeft || window.pageXOffset;
    current_y = document.body.scrollTop || window.pageYOffset;
}

	function drags(e){

if (!ie&&!ns6)
return
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"
//alert(firedobj.className);
//alert(firedobj.name);

if (firedobj.tagName!="INPUT" && firedobj.tagName!="scrollbar" && firedobj.id!="settings2" && firedobj.id!="archive1")
{
    while (firedobj.tagName!=topelement&&firedobj.className!="drag")
    {
    //alert(firedobj.tagName);
		//alert(firedobj.tagName);
		firedobj=ns6? firedobj.parentNode : firedobj.parentElement
    }
   
 }
//alert(firedobj.className);
if (firedobj.className=="drag")
{

	dragapproved=true
	z=firedobj
	temp1=parseInt(z.style.left+0)
	temp2=parseInt(z.style.top+0)
	x=ns6? e.clientX: event.clientX
	y=ns6? e.clientY: event.clientY
		//alert(z.style.left);
	//if(temp1==0)
		//temp1=200;
	
	document.onmousemove=move
	return false
}
}
 function setPageValue(pgno,mode)
    {
		document.getElementById('pgno').value=pgno;
		var mode1=mode;
		//alert("pgno " + document.getElementById('pgno').value);
		Home.insertclickpage(document.getElementById('pgno').value,document.getElementById('txtClinthostadd').value,document.getElementById('hidpubid').value,insertclickpage_callback);
		/*if(mode1=="2")
		{
		 var leftpage=parseInt(document.getElementById('pgno').value)-1;
		 if(leftpage!="0")
		 {
			Home.insertclickpage(leftpage,document.getElementById('txtClinthostadd').value,insertclickpage_callback);
		 }
		//alert("pgno " + document.getElementById('pgno').value);
		//alert("made "+mode);
		}*/
    }
    function insertclickpage_callback(response)
    {
    //alert('msg');
   // msg=response.value;
   //alert(msg);
    }
