	/*********************************************************************
* Copyright 2008 Amblique :: www.amblique.com :: All Rights Reserved *
**********************************************************************
* JAVASCRIPT AND OTHER SCRIPTING
*********************************************************************/

/**********************************
* jQuery
**********************************/
jQuery(document).ready(function(){

	// PopupWindow :: http://plugins.jquery.com/project/PopupWindow
	var profiles = {
		popupToolsPrint:{height:500,width:600,center:1,scrollbars:1,status:0,resizable:1},
		popupToolsPrintGallery:{height:590,width:720,center:1,scrollbars:1,status:0,resizable:1},
		popupToolsEmail:{height:400,width:500,center:1,scrollbars:1,status:0,resizable:1}
	};
	$(".tool").popupwindow(profiles);
	// jQuery Lightbox :: http://leandrovieira.com/projects/jquery/lightbox
	
	// Your code goes here
	$(function() {
		$('.contentProductDetails .content-top .content-one .image a').lightBox();
		$('.contentProductDetails .content-top .content-one .buttons a.link-viewlarger').lightBox();
	});
	
});

/**********************************
* Custom scripts
**********************************/

/***** Popup windows *****/
function PopUpSend(URL) {
	window.open(URL,"Send","height=400,width=500,scrollbars=yes,menubar=no,statusbar=no,personalbar=no,locationbar=no");
}
function PopUpPrint(URL) {
	window.open(URL,"Print","height=500,width=500,scrollbars=yes,menubar=no,statusbar=no,personalbar=no,locationbar=no"); 
}

/***** Google toolbar yellow fields Fix *****/
if(window.attachEvent)
window.attachEvent("onload",setListeners);

function setListeners(){
inputList = document.getElementsByTagName("INPUT");
for(i=0;i<inputList.length;i++){
	inputList[i].attachEvent("onpropertychange",restoreStyles);
	inputList[i].style.backgroundColor = "";
}
selectList = document.getElementsByTagName("SELECT");
	for(i=0;i<selectList.length;i++){
		selectList[i].attachEvent("onpropertychange",restoreStyles);
		selectList[i].style.backgroundColor = "";
	}
}
function restoreStyles(){
	if(event.srcElement.style.backgroundColor != "" && event.srcElement.style.backgroundColor != "#a0d0ff"){
		event.srcElement.style.backgroundColor = "#a0d0ff"; /* color of choice for AutoFill */
		document.all['googleblurb'].style.display = "block";
	}
}

function isdefined( variable)
{
    return (typeof(variable) == "undefined")?  false: true;
}


/***** Category List *****/

        function caCallback_CallbackError(sender, eventArgs)
        {
            alert("Callback error has occured");
        }
        
        /* Products Per Page Filter */
        function ddlProductsPerPage_onChange()
        {
            try
            {
                // Drop down list object
				var obj = $("ddlProductsPerPage");
				
				// Selected value
				var productsPerPage = obj.options[obj.selectedIndex].value;
				
				// Update the hidden textbox
				$("tbProductsPerPage").value = productsPerPage;
				// Run callback
				caCallback_Callback("ChangePageSize", "pagesize=" + productsPerPage + ";");
            }
            catch (ex)
            {
                alert("ddlProductsPerPage_onChange:\n" + ex);
            }
            finally
            {
            }
        }
        
        /* Sort By Filter */
        function ddlSortBy_onChange()
        {
            try
            {
            
                // Drop down list object
				var obj = $("ddlSortBy");
    			
				// Selected value
				var sortBy = obj.options[obj.selectedIndex].value;
				
				// Update the hidden textbox
				$("tbSortBy").value = sortBy;

                // Run callback
				caCallback_Callback("", "sortby=" + sortBy + ";");
            }
            catch (ex)
            {
                alert("ddlSortBy_onChange:\n" + ex.description);
            }
            finally
            {
            }
        }
        
        /* Change current page index */
        function ChangePageIndex(index)
        {
            try
            {
				
                if (index && typeof(index) == "number")
                {
                    // Update the hidden textbox
                    $("tbCurrentPage").value = index;
                    
                    // Run calback
                    caCallback_Callback("", "currentpage=" + index + ";");
                }
            }
            catch (ex)
            {
                alert("ChangePageIndex:\n" + ex.description);
            }
            finally
            {
            }
        }
		
		function caCallback_Complete()
{
	alert('complete');
}