/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function queryProducts(page){
    var one = $.cookie("one");
    var two = $.cookie("two");
    var three = $.cookie("three");
	var four = $.cookie("four");
    getDynoProducts(one, two, three, four, page);
}

function getDynoProducts(subsubid,subid,cateid,brandid,page){
    cookieEvents(subsubid,subid,cateid,brandid,page,"getDynoProducts");

	if(subsubid == -20){
		$.ajax({
        url:"products2.php?subCateId="+subid+"&cateId="+cateid+"&brandId="+brandid+"&page="+page,
        type:"POST",
        success:function(msg){
            clearScreen(false,true,true);
            if($("#sbdContent_center").children("#availableProducts").length < 1){
                $("#sbdContent_center").prepend("<div id='availableProducts'></div>");
            }
            $("#availableProducts").html(msg);
        	}
    	});		
	}else{
		$.ajax({
        url:"products.php?subSubCategoryId="+subsubid+"&subCateId="+subid+"&cateId="+cateid+"&brandId="+brandid+"&page="+page,
        type:"POST",
        success:function(msg){
            clearScreen(false,true,true);
            if($("#sbdContent_center").children("#availableProducts").length < 1){
                $("#sbdContent_center").prepend("<div id='availableProducts'></div>");
            }
            $("#availableProducts").html(msg);
        	}
    	});	
	}	
    
	scroll2Top();
}


function getProductDetails(id)
{
    $.ajax({
        url:"details.php?productId="+id,
        type:"GET",
        success:function(msg){
            clearScreen(true, true, false);
            if($("#sbdContent_center").children("#productDetails").length < 1){
                $("#sbdContent_center").prepend("<div id='productDetails'></div>");
            }
            $("#productDetails").html(msg);
        }
    });
    scroll2Top();
}

function buyProduct(id){
    add2Cart(id);
	setTimeout(viewCart,1000);
}
