$(document).ready(function() {
    var type = $().getParmByUrl("productType");
	var sort=$().getParmByUrl("OrderSort");
	var catID = $().getParmByUrl("cid");
	var pID = '0';
	var productType = '';
	if(type != undefined)
	{
	    productType = '&productType=' + type;
	}
	if(extend == '')
	{
	    pID = $().getParmByUrl("PID");
	}
	else
	{
	    var currentUrl = window.location.toString();
	    var startID = currentUrl.lastIndexOf('_') + 1;
	    var endID = currentUrl.lastIndexOf('.');
	    pID = currentUrl.substring(startID,endID);
	}
	
	if(sort == undefined || sort ==""){sort = "1";}
	if(catID == undefined || catID == ""){catID = "0";}

//	var weburl = baseUrl + 'ajax.aspx?NoCopyright=1&type=GetPreNextProductID&PID=' + pID + '&catID=' + catID + '&OrderSort=' + sort + productType + '&ran=' + Math.random();
	var weburl = baseUrl + 'ajax.aspx?NoCopyright=1&type=GetPreNextProductID&PID=' + pID + '&ran=' + Math.random();
	$.get(weburl,function(data){
	    var preID = data.split('|')[0];
	    var nextID = data.split('|')[1];
	    var url = '';
	    var urlPara = '&cid=' + catID + '&OrderSort=' + sort;
	    if(extend == '')
	    {
	        url = baseUrl + 'Show.aspx';
	        if(preID != '0')
	        {
	            $('#preProduct').html('<a href="' + url + '?PID=' + preID + '">'+ preProduct +'</a>').addClass('pre_next_bg1');//上一个
	        }
	        else
	        {
	            $('#preProduct').html(preProduct).addClass('pre_next_bg2');//没有上一个商品时无链接
	        }
	        if(nextID != '0')
	        {
	            $('#nextProduct').html('<a href="' + url + '?PID=' + nextID + '">' + nextProduct + '</a>').addClass('pre_next_bg1');
	        }
	        else
	        {
	             $('#nextProduct').html(nextProduct).addClass('pre_next_bg2');//没有下一个商品时无链接
	        }
	    }
	    else
	    {
	        url = baseUrl + 'products/Product_';
	        urlPara = urlPara.substring(1);
	        urlPara = '?' + urlPara;
	        if(preID != '0')
	        {
	            $('#preProduct').html('<a href="' + url + preID + '.' + extend + '">' + preProduct + '</a>').addClass('pre_next_bg1');
	        }
	        else
	        {
	            $('#preProduct').html(preProduct).addClass('pre_next_bg2');
	        }
	        if(nextID != '0')
	        {
	            $('#nextProduct').html('<a href="' + url + nextID + '.' + extend + '">' + nextProduct + '</a>').addClass('pre_next_bg1');
	        }
	        else
	        {
	             $('#nextProduct').html(nextProduct).addClass('pre_next_bg2');
	        }
	    }

	});
	
	
	
	
	
});