<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="showLarger.aspx.cs" Inherits="Maticsoft.Web.showLarger" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="Css/public.css" rel="stylesheet" type="text/css" />

    <script src="js/viewpage.js" type="text/javascript"></script>

    <script type="text/javascript">


var ie=document.all;
var nn6=document.getElementById&&!document.all;
var isdrag=false;
var x,y;
var dobj;
function movemouse(e)
{
//alert('进去了');
    if (isdrag)
    {
	//alert('进去了');
        dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;
        dobj.style.top = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
        return false;
    }
}
function selectmouse(e)
{
//alert('进去了');
    var fobj = nn6 ? e.target : event.srcElement;
    var topelement = nn6 ? "HTML" : "BODY";
    while (fobj.tagName != topelement && fobj.className != "dragme")
    {
        fobj = nn6 ? fobj.parentNode : fobj.parentElement;
    }
    if (fobj.className=="dragme")
    {
        isdrag = true;
        dobj = fobj;
        tx = parseInt(dobj.style.left+0);
        ty = parseInt(dobj.style.top+0);
        x = nn6 ? e.clientX : event.clientX;
        y = nn6 ? e.clientY : event.clientY;
        document.onmousemove=movemouse;
        return false;
    }
}
function pagename()
{

window.location="showLarger.aspx?paperName="+escape(document.getElementById("hidden_paperName").value)+"&qnum="+escape(document.getElementById("hidden_Qnum").value)+"&pagenum="+escape(document.getElementById("hidden_pagenum").value);
}

var isIeWheel=navigator.userAgent.indexOf('MSIE') > 0 ? true : false;
function zoomimg(e)
{
//alert(e);
    var ev;
    if (ie)
    {
        ev=event;
    }else{
        ev=e;
    }
    
    if (ev.altKey)
    {
        var delta = 0;
        if (e.wheelDelta)
        {
            delta = e.wheelDelta/120;
            if (window.opera)
            delta = -delta;
        }
        else if (e.detail)
        {
            delta = -e.detail / 3;
        }
        var objImage = nn6 ? e.target : e.srcElement;
        var topelement = nn6 ? "HTML" : "BODY";
        while (objImage.tagName != topelement && objImage.className != "dragme")
        {
            objImage = nn6 ? objImage.parentNode : objImage.parentElement;
        }
        if (objImage.className=="dragme")
        {
            var int_zoom=delta;
            var int_zoom_width = 0;
            var int_zoom_height = 0;
            var int_zoomout_ie = 10;
            var int_zoomout_ff = 10;
            var int_min_width = 50;
            var int_min_height = 80;
            if (isIeWheel)
            {
                var int_zoom_ie = parseInt(objImage.style.zoom) || 100;
                int_zoom_ie += int_zoomout_ie * int_zoom;
                if (int_zoom_ie > 0 ) objImage.style.zoom = int_zoom_ie + "%";
            }
            else
            {
                if (objImage.width > objImage.height)
                {
                    int_zoom_height = objImage.height + int_zoomout_ff * int_zoom;
                    int_zoom_width = objImage.width * int_zoom_height / objImage.height;
                }
                else
                {
                    int_zoom_width = objImage.width + int_zoomout_ff * int_zoom;
                    int_zoom_height = objImage.height * int_zoom_width / objImage.width;
                }
                if (int_zoom_width > int_min_width && int_zoom_height > int_min_height)
                {
                    objImage.width = int_zoom_width;
                    objImage.height = int_zoom_height;
                }
            }
        }
        if (e.preventDefault)
        e.preventDefault();
        e.returnValue = false;
        //return false;
    }
   
}
//注册快捷键
function returnDefault(e)
{
    var ev;
    if (ie){ev=event;}else{ev=e;}
    
    //alert(ev.keyCode);
	//shift+'z' 文字大小切换
    if(ev.keyCode==90&&ev.shiftKey)
    {
    	var image=new Image();
    	var pagePic=document.getElementById("page_image");
			image.src = pagePic.src;
			var iwidth = 1000;
			var iheight = 2000;

      var obj= document.getElementById("pageShowSel");
      
      var selectId=obj.selectedIndex;
	    var selectVa=obj.options[selectId].value;
	    if(selectVa=='0')
	    {
	    	obj.options[1].selected=true;
	        var picWidth=image.width;
	        var picHeight=image.height;
	        pagePic.width=picWidth;
	        pagePic.height=picHeight;
	    }
	    else if(selectVa=='1')
	    {
	    	obj.options[0].selected=true;
	        adjustImageSize(image,iwidth,iheight);
	    }
	 }
	 
	// shift+A 上一版
	if(ev.keyCode==65&&ev.shiftKey)
    {
        
    }
    
    // shift+S 下一版
	if(ev.keyCode==83&&ev.shiftKey)
    {
	    
            makeUrl('order',2);
        
    }
    
    // shift+D 版面浏览
	if(ev.keyCode==68&&ev.shiftKey)
    {
	     window.location.href="Issue.aspx?issueId=5e9354fd-c175-44f6-a4f2-3b30fc03ae9d";
    }
    
    // shift+X 回首页
	if(ev.keyCode==88&&ev.shiftKey)
    {
	    window.location.href="Default.aspx";
    }
    
}

function rememberPageSize(obj){
    if (obj.checked)
    {
       var obj= document.getElementById("pageShowSel");
       var selectId=obj.selectedIndex;
       var selectVa=obj.options[selectId].value;
       
	   var cookieTest=new eyunCookie();
       cookieTest.key="PageSize";
       cookieTest.value=selectVa;
       cookieTest.expires=90*86400000;;
       cookieTest.set();
       
    }else{
       var cookieTest=new eyunCookie();
       cookieTest.del("PageSize");
    }
}

document.onmousedown=selectmouse;
document.onmouseup=new Function("isdrag=false");
if(document.attachEvent)
{
    document.attachEvent("onmousewheel",zoomimg);
    //document.attachEvent("onkeydown",returnDefault);
}
else
{
    window.addEventListener("DOMMouseScroll", zoomimg, false);
}
document.onkeydown=returnDefault;
    </script>

</head>
<body style="background-color: White;">
    <form id="form2" runat="server">

    <script type="text/javascript" src="/ajaxpro/prototype.ashx"></script>

    <script type="text/javascript" src="/ajaxpro/core.ashx"></script>

    <script type="text/javascript" src="/ajaxpro/converter.ashx"></script>

    <script type="text/javascript" src="/ajaxpro/ePaperNet.ViewPage,ePaperNet.ashx"></script>

    <div>
    </div>
    <div id="toolbar" class="tooldiv">

        <script type="text/javascript"><!--
google_ad_client = "pub-5313208362165053";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "image";
//2007-10-25: 看报页面大头图片
google_ad_channel = "9965510577";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "339933";
google_color_text = "666666";
google_color_url = "339933";
//-->
        </script>

        <br />
        <table width="100%">
            <tr>
                <td align="left">
                    <a href="http://www.hsort.com">
                        <asp:Image ID="logo" runat="server" Width="200" Height="52" /></a>
                </td>
                <td>
                   <%--文字大小:--%>
                </td>
                <td>
                  <%--  <select id="pageShowSel" class="pageSel" onchange="javascript:adjustPageSize(this);">
                        <option value="0">适合页面</option>
                        <option value="1">最大文字</option>
                    </select>--%>
                    <input type="hidden" id="hidden_paperName" runat="server" />
                    <input type="hidden" id="hidden_Qnum" runat="server" />
                     <input type="hidden" id="hidden_pagenum" runat="server" />
                </td>
                <td>
                    <a href="<%=getUrl() %>">下一版</a>
                </td>
                <td>
                    | <a href="javascript:window.close();" title="点击此处关闭当前页面">关闭</a>
                </td>
                <td align="right">
                    <div id="detail" align="center" runat="server">
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div align="center">
        <img id="page_image" class="dragme" runat="server" />
    </div>
    <div id="enetMeng">

        <script type="text/javascript"><!--
google_ad_client = "pub-5313208362165053";
google_alternate_color = "339933";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
//2007-07-24: 看报页面弹出窗口
google_ad_channel = "7660711392";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "336699";
google_color_text = "666666";
google_color_url = "336699";
//-->
        </script>

    </div>

    <script type="text/javascript">
function scall()
{
    document.getElementById("toolbar").style.top=document.body.scrollTop;
    document.getElementById("toolbar").style.left=(document.body.scrollLeft+(document.body.clientWidth-document.getElementById("toolbar").offsetWidth)/2);
}
scall();
window.onscroll=scall;
window.onresize=scall;
var pagePic=document.getElementById("page_image");
var picWidth=0;
var picHeight=0;
function adjustImageSize(image,iwidth,iheight)
{
    picWidth=image.width;
    picHeight=image.height;
    if(image.width>0 && image.height>0)
    {
        if(image.width/image.height >= iwidth/iheight)
        {
            if(image.width>iwidth)
            {
                pagePic.width=iwidth;
                pagePic.height=(image.height*iwidth)/image.width;
            }
            else
            {
                pagePic.width=image.width;
                pagePic.height=image.height;
            }
        }
        else
        {
            if(image.height>iheight)
            {
                pagePic.height=iheight;
                pagePic.width=(image.width*iheight)/image.height;
            }
            else
            {
                pagePic.width=image.width;
                pagePic.height=image.height;
            }
        }
    }
    else
    {
        pagePic.width=iwidth;
    }
}
var image=new Image();
image.src = pagePic.src;

var iwidth = 1000;
var iheight = 2000;

var cookieTest=new eyunCookie();
if (cookieTest.get("PageSize"))
{   
    var iPageSize=cookieTest.get("PageSize");
    if (iPageSize==0)
    {
        adjustImageSize(image,iwidth,iheight);
    }else{
        var obj= document.getElementById("pageShowSel");
	    obj.options[1].selected=true;
    }
}else{
    adjustImageSize(image,iwidth,iheight);
}

function adjustPageSize(obj)
{
    var selectId=obj.selectedIndex;
    var selectVa=obj.options[selectId].value;
    if(selectVa=='0')
    {
        adjustImageSize(image,iwidth,iheight);
    }
    else if(selectVa=='1')
    {
        picWidth=image.width;
        picHeight=image.height;
        pagePic.width=picWidth;
        pagePic.height=picHeight;
    }
}
 




  
  
  //openD();
  
  
//queryMessage();
setInterval("queryMessage()",30*1000);

    </script>

    </form>
</body>
</html>
