var user_productid=""; 
var user_platforms="";
function product_selected(pid)
{ 
    if(GetCookie("user_productid") == pid)
    {
        SetCookie("user_productid",pid,100,"/") 
        return;
    }
    try{
        cancelPopup();
    }
    catch(e){}
    SetCookie("user_productid",pid,100,"/") 
    user_productid   =   pid;  
    if($("product_showbox")!=null)
    $("product_showbox").innerHTML=""; 
    var url="/trigers/product/set/?pid=" + user_productid; 
    //window.open(url); 
    var myAjax = new Ajax.Request(   
        url,
        { method: 'get',onComplete:function(r){ 
            SetCookie("user_platforms",r.responseTEXT,1,"/")  
            reloadphone();        
            }
        }
    );   
}
function reloadphone()
{
    if(document.location.href.indexOf("list")>0)
        document.location.reload();
    else
    {
        var url="/serves/product/html/?pid=" + user_productid; 
        //window.open(url); 
        var myAjax = new Ajax.Updater(  
            "product_showbox",
            url,
            { method: 'get',onError:function(){$("product_showbox").innerHTML="载入数据出错！请联系管理员。";}
            
            }
        );   
        $("product_showbox").style.display="block";
        try{ 
            load_donwloadlinks();
        }
        catch(e){ }
        
    }
}
 
function loadproductsetting()
{
    user_productid = GetCookie("user_productid"); 
    user_platforms = GetCookie("user_platforms");  
    if(user_productid=="")
    { 
        load_gp_brand();
    }
    else
    { 
	    var url="/serves/product/html/?pid=" + user_productid; 
        //window.open(url); 
        var myAjax = new Ajax.Updater(  
            "product_showbox",
            url,
            { method: 'get',onError:function(){$("product_showbox").innerHTML="载入数据出错！请联系管理员。";}
            
            }
        );   
    }
} 
function resetproductsetting()
{ 
    var loc=new String(location.href);
    if(loc.indexOf("/list/")>0)
    {
        loc=loc.replace("&pid=" + user_productid,"");
    }
    SetCookie("user_productid","",1,"/")  
    SetCookie("user_platforms","",1,"/")  
    if(loc.indexOf("/list/")>0)
    {
        location.href=loc;
        return;
    }
    user_productid   =  "";   
    $("product_showbox").innerHTML="<div class=\"add_5_24_right\"><p>请先设置您的手机型号以便找到最适合您的手机软件</p><a href=\"#\" onclick=\"showBox('/Product/Search/',518,230);\" class=\"sz\">设置我的手机</a></div>";
    load_gp_brand(); 
    try{
        
        user_platforms = GetCookie("user_platforms"); 
        doFilter();
    }
    catch(e){ }
} 