﻿    //图书购买
       function buy(bookid,bookName,price,discount,jk)
       {
         var obj = jk;
         if(!confirm('确定购买吗？'))
        { return;}
         
         waited(obj);
         
           $.post(
                "/Detail/XMLshopping.aspx",
                { Bookid: bookid, BookName: bookName, Price: price, Discount: discount  },
                function(xml) {
                    DDXCommon.ShowRequestedMsg(xml, window.location);
                },
                "xml"
            );
       }
       
    //提交调查
       $(function (){  
        $('#AddAnswer').bind('click', function() { 
            var item=$('input[name=rdo_yj]');
            var len=item.length; 
            var itemValues="";
            for(var i=0;i<len;i++)
            {
                if($(item[i]).attr('checked'))
                { 
                    if(itemValues=="")
                    {
                        itemValues+=$(item[i]).val(); 
                    }
                    else
                    {
                        itemValues+=","+$(item[i]).val(); 
                    } 
                }
            }  
            var obj = $(this);
            if (!itemValues || itemValues.length == 0) {
                alert('请先进行选择！');
                return;
            } 
            waitedOption(obj);
            var d = new Date();  
            $.get(
                "/XMLAjax/XMLInfoSurvey.aspx?d="+new Date(),
                { OptionID: itemValues,type: 1 },
                function(xml) {  
                    DDXCommon.ShowRequestedMsg(xml);
                },
                "xml"
            );
        });
    });
     
     //确认框
     function waited(tarobj) {
        var p = $(tarobj).position();
        var top = p.top; 
        var left = p.left; 
        var height = $(tarobj).height();
        $('#requestMsg').css('top', top + height + 5);
        $('#requestMsg').css('left', left);
        $('#requestMsg').attr('class', 'wait');
    }
    
    function waitedOption(tarobj) {
        var p = $(tarobj).position();
        var top = p.top;
        var left = p.left; 
        var height = $(tarobj).height();
        $('#requestMsg').css('top', top + height + 5);
        $('#requestMsg').css('left', left);
        $('#requestMsg').attr('class', 'wait');
        $('#requestMsg').css('width', 200);
    }
    
    
    
 

