﻿function showDiv(id)
{
    if (id != '')
    {
        var div = document.getElementById(id);
        
        if (div.style.display == 'block')
            div.style.display = 'none';
        else
            div.style.display = 'block';
    }
}
function search() {
    var searchString = document.getElementById('tbSearchquery').value;
    if (searchString != '')
        window.frames[0].location.href = 'Search.aspx?q=' + searchString;
} 
function captureReturn( event )
{
    if(event.which || event.keyCode)
    {
	    if ((event.which == 13) || (event.keyCode == 13)) 
	    {
	        document.form1
		    search();			    
		    return false;
	    }
	    else 
	    {
		    return true;
	    }
	}
}    
function goToCategory(id) {
    frames[0].window.location = 'Category.aspx?catid=' + id;
}    
function searchboxFocus()
{
    document.getElementById('tbSearchquery').focus();        
}

function alertMessage(text, redirectPage)
{
    alert(text);   
    if (redirectPage != '') 
        self.location = redirectPage;
    else
        self.location = 'Start.aspx';
}
function imageManagerPopup()  {
    var w = window.open('../../ImageManager.aspx', 'AceShopImageManager', 'status=1,height=502,width=700,resizeable=0');    
    w.focus();
    return false;
}
function imageHandlerShowHelpDiv(show, id)
{
    var element = document.getElementById(id);
    
    if (show) {
        var opacity = 90;
        element.style.display = 'block';
        element.style.opacity = (opacity / 100);
        element.style.MozOpacity = (opacity / 100);
        element.style.KhtmlOpacity = (opacity / 100);
        element.style.filter = "alpha(opacity=" + opacity + ")";
    }
    else {
        element.style.display = 'none';
    }
}
function imageHandlerThumbnail(id, onmouseover) {
    
    var element = document.getElementById(id);
    var opacity = 100;
    
    if (onmouseover) {
        opacity = 50;                        
    }
    
    element.style.opacity = (opacity / 100);
    element.style.MozOpacity = (opacity / 100);
    element.style.KhtmlOpacity = (opacity / 100);
    element.style.filter = "alpha(opacity=" + opacity + ")";
}
