/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
hs.showCredits = false;
hs.captionEval = 'this.thumb.alt' /* Show product name as caption */
hs.align = 'auto';
hs.transitions = ['expand', 'crossfade'];
hs.outlineType = 'rounded-white';
hs.fadeInOut = true;
hs.expandDuration = 200;
hs.numberPosition = 'caption';
hs.dimmingOpacity = 0.10;
hs.lang = {
    loadingText :     'Lade...',
    loadingTitle :    'Klick zum Abbrechen',
    focusTitle :      'Klick um nach vorn zu bringen',
    fullExpandTitle : 'Zur Originalgröße erweitern',
    fullExpandText :  'Vollbild',
    creditsText :     'Powered by <i>Highslide JS</i>',
    creditsTitle :    'Gehe zur Highslide JS Homepage',
    previousText :    'Voriges',
    previousTitle :   'Voriges (Pfeiltaste links)',
    nextText :        'Nächstes',
    nextTitle :       'Nächstes (Pfeiltaste rechts)',
    moveTitle :       'Verschieben',
    moveText :        'Verschieben',
    closeText :       'Schließen',
    closeTitle :      'Schließen (Esc)',
    resizeTitle :     'Größe wiederherstellen',
    playText :        'Abspielen',
    playTitle :       'Slideshow abspielen (Leertaste)',
    pauseText :       'Pause',
    pauseTitle :      'Pausiere Slideshow (Leertaste)',
    number :          ''/*'Bild %1/%2'*/,
    restoreTitle :    'Klick um das Bild zu schließen, klick und ziehe um zu verschieben. Benutze Pfeiltasten für vor und zurück.'
};

$(document).ready(function(){

    $(".catListing1Element").hover(
        function () {
            $(this).attr("class","catListing1ElementOver")
        },
        function () {
            $(this).attr("class","catListing1Element")
        }
        );

    $(".productListing1ColBodyImg").hover(
        function () {
            $(this).attr("class","productListing1ColBodyImgOver")
        },
        function () {
            $(this).attr("class","productListing1ColBodyImg")
        }
        );

    $(".tbListingTr").hover(
        function () {
            $(this).addClass("tableListingTrOver")
        },
        function () {
            $(this).removeClass("tableListingTrOver")
        }
        );
    $("#suggestSearch").keyup(function(event){
    
    var queryText = $("#suggestSearch").val();
    if (queryText.length > 2) {
        ajaxSuggest();
    } else {
    	$("#suggestResult").slideUp();
    }
 
	});	

});

function ajaxSuggest() {
	
	var getFormData = $("#quick_find").serialize();
	
    $.ajax({
        type: "POST",
        url: "getAjaxSuggest.php",
        data: getFormData,
        dataType: "html",
        success: function(msg){
        	if (msg.length > 0) {
            	$("#suggestResult").html(msg);
            	$("#suggestResult").slideDown();
            } else {
            	$("#suggestResult").slideUp();
            }
        }
    });
}

function inputSuggest(elementLi) {
	$("#suggestSearch").val( $(elementLi).html() );
	$("#quick_find").submit();
}


function ajaxFramePrice(markerId,markerValue) {

    $("#id_"+markerId).attr("checked","checked");
    $('#tr_id_'+markerId).effect("highlight", {
        color:'#F04F19'
    }, 1000);
    $('#tr_id_'+markerId).effect("transfer", {
        to: ".prodPriceInfo1Ajax"
    }, 500);
    setTimeout(function() {
        $('.prodPriceInfo1Ajax').effect("highlight", {
            color:'#F04F19'
        }, 1000)
        }, 1500 );

    var getFormData = $("#cart_quantity").serialize();
    $.ajax({
        type: "POST",
        url: "getAjaxFramePrice.php",
        data: getFormData,
        dataType: "json",
        success: function(msg){
            var outputLine = "<table id=\"frameOverviewOutput\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" >";
            for (var show in msg.attribPrice) {
                var optName = msg.attribPrice[show].nameOpt;
                var atrName = msg.attribPrice[show].nameAttrib;
                var optPrice = msg.attribPrice[show].price;
                outputLine += '<tr><td>'+ atrName + ':</td><td class="overviewPriceTd">' + optName + '</td></tr>';
            }
            outputLine += '<tr><td>Gew&auml;hlte Kombination:</td><td class="overviewPriceTd">' + msg.printPrice + '</td></tr>';
            outputLine += '<tr><td class="overviewSumme">Gesamtpreis:</td><td class="overviewPriceTd overviewSumme">' + msg.endPrice + '</td></tr>';
            outputLine += '</table>';
            //$("#attribPrice").html(outputLine);
            $(".prodPriceInfo1Ajax").html(msg.endPrice);
        }
    });
}
