var miniUserPanel = {
    close:function() {//close the panel
        jQuery("#popupPanel").html("");
    },
    reLocate:function() {//re-locate the block when beyond the document
        var obj =  jQuery("#popupPanel");
        attr = {
            wth:obj.width(),
            hgt:obj.height()
        }
        obj.css({
        	"z-index":"10000",
            "top":jQuery().scrollTop() + (jQuery(window).height() - attr.hgt)/2,
            "left":jQuery().scrollLeft() + (jQuery(window).width()-attr.wth)/2
        })
    }
}
jQuery().ready(function () {
    //create popupPanel
    var popupPanel =  jQuery("<div id=\"popupPanel\"></div>");
    popupPanel.appendTo("body").css({
    });

    //Authentiction user quick feedback for products by jinjianting
    jQuery(".fastFbBat").click(function() {
    	var sampleId = jQuery("#sampleId").attr('value');
    	var clyt = jQuery("#clyt").attr('value');
        var fdPrice = jQuery("#fdPrice").attr('checked');
        var minCountForOrder = jQuery("#minCountForOrder").attr('checked');
        var fdDeliDate = jQuery("#fdDeliDate").attr('checked');
        var fdDeliWay = jQuery("#fdDeliWay").attr('checked');
        var paymentTerm = jQuery("#paymentTerm").attr('checked');
        var paymentCurrency = jQuery("#paymentCurrency").attr('checked');        
        var targetUrl=jsonMsg.myalibabaModule+"/reg/feedback_for_sample_quick.htm?t=20&isFastFeedback=true&sids="+sampleId;       
        if(fdPrice == 1||minCountForOrder == 1||fdDeliDate == 1||fdDeliWay == 1||paymentTerm == 1||paymentCurrency == 1){
        	if(fdPrice == 1){
            	targetUrl += "&fdPrice=1";
            }
            if(minCountForOrder == 1){
            	targetUrl += "&minCountForOrder=1";
            }
            if(fdDeliDate == 1){
            	targetUrl += "&fdDeliDate=1";
            }
            if(fdDeliWay == 1){
            	targetUrl += "&fdDeliWay=1";
            }
            if(paymentTerm == 1){
            	targetUrl += "&paymentTerm=1";
            }
            if(paymentCurrency == 1){
            	targetUrl += "&paymentCurrency=1";
            }
            targetUrl += "&clyt="+clyt;
    		
            jQuery.ajax({
                "type":"get",
                "data": "desURL=" + encodeURIComponent(targetUrl),
                "dataType" : 'text/html',
                "url":"/member/mini_user_panel.htm",
                "cache":false,
                "success":function(data) {
            	   var message = data.replace(/(^[\s\t\n\r]*)|([\s\t\n\r]*$)/g, "");

            	   if( message == 'logined_complete'){
            		   // logined user logic
               			   window.location = targetUrl;
            	   }else{
                       jQuery("#popupPanel").html(data)
                                           .css({"position":"absolute"})
                                           .show();
                       miniUserPanel.reLocate();
                       	   }
            	   }
            })
        }else{
        	alert(jsonMsg.no_checked);
        	return false;
        }
		return false;
    });
    //unauthorized user quick register and feedback by Evance 2010-01-21
    jQuery("li.jQ-fbForPrdt a").bind("click",function() {
        var targetUrl = jQuery(this).attr("href");
        jQuery.ajax({
            "type":"get",
            "url":"/member/mini_user_panel.htm",
            "data": "desURL=" + encodeURIComponent(targetUrl),
            "cache":false,
            "success":function(data) {
        	   var message = data.replace(/(^[\s\t\n\r]*)|([\s\t\n\r]*$)/g, "");

        	   if( message == 'logined_complete'){
        		   // logined user logic
           			   window.location = targetUrl;
        	   }else{
                    jQuery("#popupPanel").html(data)
                                         .css({"position":"absolute"})
                                         .show();
                    miniUserPanel.reLocate();
                   	   }
        	   }
        })
        return false;
    })
});

