//-----------------------------------------------------------------------------
// Document ready
// Description: All functions who need document ready should go here
//-----------------------------------------------------------------------------
$(document).ready(function(){	
	$("tr[@class^=tr]").hide().children("td");
	$("button[@class^=hide]").hide();
	
	$("div[@class^=accordion-body]").hide();
	$("div[@id^=hide-]").hide();


$('.quantityinput').numeric();
$('.quant').numeric();




});






//-----------------------------------------------------------------------------
// ChangeAccordion
// Description: Change status from the accordion
//-----------------------------------------------------------------------------
function ChangeAccordion(id, status) {
	if (status == true) {
			//alert(status);
			$("#a1").fadeIn(300);
			$("#show-1").hide();
			$("#hide-1").show();
		} else {
			//alert(status);
			$("#a1").slideUp(300);
			$("#show-1").show();
			$("#hide-1").hide();
		}	
}


//-----------------------------------------------------------------------------
// getProductDetails
// Description: AJAX call to access the remote data
//-----------------------------------------------------------------------------
function getProductDetails(id, counter, AttributeSetDefID, AssortmentObjID, status) {

if (status == true) {	

		$('#maintr'+counter).addClass("linetr-on");
		
$.ajax({
	type:   'GET',
	url:	'ajax.cfm',
	dataType: 'html',
	data: 	'cc=' + id + '&setdefid=' + AttributeSetDefID + '&objid=' + AssortmentObjID, //cc=' + i.src,
	timeout: 30000,
	beforeSend:  function() {
		//alert("##results"+counter);

		$('.tr'+counter).toggle();
		$('.show'+counter).hide();
		$('.hide'+counter).show();

		$("#message"+counter)
		.css({
			display: 'none',
			margin: '0',
			padding: '0',
			width: '500px',
			fontSize: '12px',
			color: '#000',
			background: 'url(../../cbm_assets/images/ajax-loader.gif) no-repeat left'
		})
		.fadeIn(400);
	},
	error: function() {
		//alert("ERROR");
	},
	success:  function(html) {
		//alert(AttributeSetDefID + ' ' + AssortmentObjID);	
		$("#results"+counter).append(html);
	},
	complete:  function() {
		$("#message"+counter).fadeOut(400,function(){
			$(this).remove();
		});
	}
});

} else {

$('#maintr'+counter).removeClass("linetr-on");
$('#maintr'+counter).addClass("linetr-off");

$(".tr"+counter).fadeOut(400);
$('.show'+counter).show();
$('.hide'+counter).hide();

$("#results"+counter).empty();
$("#message"+counter).empty();
	
}

}


//-----------------------------------------------------
// Desc: Collapse/expand for <tr> row on article page
//-----------------------------------------------------
//$(document).ready( function () {
//$('.expand').parent().next().hide();
//    $(".expand").click(function() {
//	$(this).removeClass('close');
//                        $("img",this).attr("src", 
//                        $("img",this).attr("src")=="minus.gif" ? "plus.gif" : "minus.gif"
 //                       );
//    $(this).parent().next().toggle();
//    });
//});

//$(function() {
//	$('td.parent')
//		.click(function(){
//		$('.child-'+this.id).toggle();

//	    $("##"+this.id).removeClass("close");
//		$("##"+this.id).addClass("open");

//		});
//		$("tr[@class^=child-]").hide().children("td");

//});






