﻿// JScript File
function aaReady()
{	

 


<!-- QuickView -->
		
		$(".prodQuickview").click(function(){
		    //alert("hi");
		     var current_id = $(this).attr('id');
		    //alert("hdnTemplateId"+document.getElementById('ctl00_ContentPlaceHolder1_hdnTemplateId').value);
		    document.getElementById('ctl00_ContentPlaceHolder1_hdnTemplateId').value =current_id;
    	   
    	    var height="#height" + current_id ;   
		    //$('#aheight').html($(height).val());
		    
		     var width="#width" + current_id ;   
		    //$('#aheight').html($(width).val());
		    
		    var cardtype="#cardtype" + current_id ;   
		    //$('#astyle').html($(cardtype).val());
		    
		    var minprice="#minprice"+current_id;
		    //$('#aminprice').html($(minprice).val());
		    
		    var categoryname="#categoryname"+current_id;
		    //$('#acategoryname').html($(categoryname).val());
		    var itemno="#ItemNo"+current_id;

//		    if(itemno=="#ItemNo" || itemno=="undefined")
//		    {
//		        var detail=" " + $(cardtype).val()+ "<br/>" + " " + $(width).val()+ " W ×" +$(height).val()+ " H" + "<br/>" + " " +$(categoryname).val()+ "<br/>" + " as low as $" + $(minprice).val()+" each";
//		    }
//		    else
//		    {
//		    }
		    //all details
//		    var detail=" " + $(itemno).val() + "<br/>" + $(cardtype).val()+ "<br/>" + " " + $(width).val()+ " W ×" +$(height).val()+ " H" + "<br/>" + " " +$(categoryname).val()+ "<br/>" + " as low as $" + $(minprice).val()+" each";

            var detail= " " +$(categoryname).val()+ "<br />" + " " +  $(itemno).val() + "<br />" + " "+ $(cardtype).val()+ "<br/>" + " " + $(width).val()+ " W ×" +$(height).val()+ " H" + "<br/>"  + " as low as $" + $(minprice).val()+" each";
		   
		     $('#adetail').html(detail);
		     
		    
		     //imagepath
		    var imgpath= $("#img"+current_id).attr('src');
		    var imgpathlarge=imgpath.replace("_sml","_prw");
		    $('#imgPreview').attr({src:imgpathlarge});
		    
		    var impreviewid="xxx"+current_id;
		    $('#dummy').attr({id:impreviewid});
		    
		    // Product name
		    var productname=$("#img"+current_id).attr('alt');
		    $('h3').html(productname);
		    
		    // alert(imgpathlarge);
		    // document.getElementById('ctl00_ContentPlaceHolder1_imgPreview').src=imgpath;
		  
			$("#quickviewPopupContainer").hide("fast", function(){
				$("#quickviewPopupContainer").vCenter();
				$("#quickviewPopupContainer").fadeIn("slow");
			
			});	
				
		
		});
		$("a.qvClose").click(function(){
			$("#quickviewPopupContainer").hide("fast");
		});
		$("a.qvClose1").click(function(){
			$("#quickviewPopupContainer").hide("fast");
		});
		
		<!-- QuickView ends -->
		
	
	
	
		$(".expand").click(function(){
			var current_id = $(this).attr('id');
			if(document.getElementById(current_id+"_box").style.display!="none"){
				$("#"+current_id+"_box").hide('medium');
				$(this).addClass('expand');
				$(this).removeClass('collapse');
			} else {
				$("#"+current_id+"_box").show('medium');
				$(this).addClass('collapse');
				$(this).removeClass('expand');
			}
		});
		
		$("#collapse_all").click(function(){
			$(".collapse").each(function(){
				var current_id = $(this).attr('id');
				$("#"+current_id+"_box").hide('medium');
				$(this).addClass('expand');
				$(this).removeClass('collapse');
			});
		});
		
		$("#expand_all").click(function(){
			$(".expand").each(function(){
				var current_id = $(this).attr('id');
				$("#"+current_id+"_box").show('medium');
				$(this).addClass('collapse');
				$(this).removeClass('expand');
			});
		});
		

        $("#clear_all").click(function(){
			$("#ctl00_ContentPlaceHolder1_container_main input").each(function(){
				if(this.type=='checkbox')
					this.checked=false;
			});
			
		});
		
		$(".expand").each(function(){
			var current_id = $(this).attr('id');
			$("#"+current_id+"_box").show('medium');
			$(this).addClass('collapse');
			$(this).removeClass('expand');
		});
			
	
	
	//alert("aaready1");

}
function clear_filters(number){
		//	alert("hi");
		$("#ctl00_ContentPlaceHolder1_id"+number+"_box input").each(function(){
		  //  alert("hey");
			if(this.type=='checkbox')
			this.checked=false;
		});
		}
$(document).ready(function(){
	
	aaReady();
	
	});
	aaReady();


	
	/*
New jss for Products Images*/
function ShowTemplateDetails(obj)
{  
 
    document.getElementById('ctl00_ContentPlaceHolder1_hdnTemplateId').value = obj.substr(3,obj.length);
    document.getElementById('ctl00_ContentPlaceHolder1_btnNext').click();
}
function ShowTemplateDetailsLink(obj)
{
    document.getElementById('ctl00_ContentPlaceHolder1_hdnLinkId').value = obj.substr(0,obj.length-1);
    document.getElementById('ctl00_ContentPlaceHolder1_btnLink').click();
}

function ShowHandCursor(obj)
{
    obj.style.cursor = "pointer";
    obj.style.color="black";
    obj.style.border = "solid 1px black";
}

function DonotShowHandCursor(obj)
{
    obj.style.cursor = "default";
    obj.style.border = "solid 1px #B6C6A9";
}

function deSelectCategory(obj)
{  
    obj.style.cursor = "default";
}

function selectTemplate(obj)
{
    obj.style.border = "solid 1px black";
    obj.style.cursor = "pointer";
}

function deSelectTemplate(obj)
{  
    obj.style.border = "solid 1px white";
    obj.style.cursor = "default";
}

function showTemplates(obj)
{  
    window.location = "http://"+location.hostname+"/PnP/Templates.aspx?Category="+obj.id;
}
