//-----------------------------------------
// ******** COMMON JAVASCRIPT ************
//-----------------------------------------
function relayout_product_tecs() {
var divs_hidden_bundle = $("div .divs_hidden_bundle_info");
if (divs_hidden_bundle.length>0) {
divs_hidden_bundle.each(function(key,value){
if (key==0) { relayout_div("#" + $(value,key).attr("id")); } // ugly patch...
relayout_div("#" + $(value,key).attr("id"));
}); // end each
} else {
relayout_div("#div_description");
} // end if
} // end function
//-----------------------------------------------------------------------------------------------------
function isIE()
{
return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
} // end if
//-----------------------------------------------------------------------------------------------------
function relayout_div(divlayout) {
var debug=false;
var total_size= 0;
var offset_col = 0;
var actual_offset=0;
$(divlayout).show();
if ((divlayout=="") || (divlayout=="undefined") || (divlayout==null) || (divlayout=="nothing")) { divlayout=""; }
var tech_cells = $(divlayout+' h4,' + divlayout + ' div.product_detail_tecnology_cell,' + divlayout + ' p:not(p#p_not_move)');
if (tech_cells.length > 0) {
// Calc total size
tech_cells.each(function(key,value){
total_size = parseFloat(total_size + $(value,key).height());
if (debug==true) { $(value,key).css("border","3px solid #000"); alert("PAUSE DEBUG"); }
}); // end each
offset_col = parseFloat(total_size / 2);
//alert("OFFSET: " + offset_col);
tech_cells.each(function(key,value){
if (actual_offset<=offset_col) {
$(divlayout + " div.div_lefty").append($(value,key).clone());
} else {
$(divlayout + " div.div_righty").append($(value,key).clone());
} // end if
actual_offset = parseFloat(actual_offset + $(value,key).height());
//alert("ACTUAL OFFSET: " + actual_offset);
$(value,key).remove();
}); // end each
} // end if
$("div .div_first_hidden_desc").hide();
} // end function
//-----------------------------------------------------------------------------------------------------
function ShowInfo(strInfo) {
if (strInfo=="") {
strInfo="UNKNOWN CMS INFO";
}
$('#divInfoContent').remove();
divString='
[ Cerrar ]
Información del Sistema
• ' + strInfo + '
';
$('#divShowInfo').prepend(divString);
$('#divShowInfo').hide();
$('#divShowInfo').slideDown("medium");
} // end function
//-----------------------------------------------------------------------------------------------------
var txt_search_product = "Escribe tu producto a buscar!";
function do_search() {
var searchitem = $("#searchfield").attr("value");
if ((searchitem=="") || (searchitem=='undefined') || (searchitem==null) || (searchitem==txt_search_product)) {
$("#searchfield").attr("value",txt_search_product);
$(".div_search").fadeOut("fast").fadeIn("fast").fadeOut("fast").fadeIn("fast");
return false;
} else {
document.frm_search.submit();
}
} // end function
//-----------------------------------------------------------------------------------------------------
function apply_fancybox() {
$('a.fancybox').fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'speedIn' : 300,
'speedOut' : 200,
'overlayShow' : true,
'autoDimensions': false,
'width' : 800
});
$('a.fancybox_big_modal').fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'speedIn' : 300,
'speedOut' : 200,
'overlayShow' : true,
'modal': true,
'autoDimensions': false,
'width' : 800,
'height' : 500
});
$('a.fancybox_technology').fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'speedIn' : 300,
'speedOut' : 200,
'overlayShow' : true,
'autoDimensions': false,
'width' : 600,
'height' : 300
});
}
function apply_nivo_slider()
{
if ($('#slider')) {
$('#slider').nivoSlider({
captionOpacity: 0.4 // Universal caption opacity
,animSpeed:200
,pauseTime:5000
});
}
}
//------------------------------------------------------------------------------
function chat()
{
olark('api.box.show');
olark('api.box.expand');
$('div#habla_window_div').fadeOut().fadeIn().fadeOut().fadeIn();
}
//------------------------------------------------------------------------------
// #####################
// ON DOM INIT
// #####################
$(document).ready(function() {
apply_fancybox();
$("#searchfield").bind("focus", function (e) {
$("#searchfield").attr("value","");
});
$("#searchfield").bind("blur", function (e) {
if ($("#searchfield").attr("value")=="") {
$("#searchfield").attr("value",txt_search_product);
}
});
$("#searchfield").keyup(function(e) {
if(e.keyCode == 13) {
do_search();
}
});
});
//-----------------------------------------------------------------------------------------------------