![]() Wholesale Fashion Jewelry & Accessory |
|
. */ var dom = (document.getElementById) ? true : false; var ns5 = (!document.all && dom || window.opera) ? true : false; var ie5 = ((navigator.userAgent.indexOf("MSIE") > -1) && dom) ? true : false; var ie4 = (document.all && !dom) ? true : false; var nodyn = (!ns5 && !ie4 && !ie5 && !dom) ? true : false; var origWidth, origHeight; // avoid error of passing event object in older browsers if (nodyn) { event = "nope" } /////////////////////// CUSTOMIZE HERE //////////////////// // settings for tooltip // Do you want tip to move when mouse moves over link? var tipFollowMouse = true; // Be sure to set tipWidth wide enough for widest image var tipWidth = 220; var offX = 20; // how far from mouse to show tip var offY = 12; var tipFontFamily = "Verdana, arial, helvetica, sans-serif"; var tipFontSize = "8pt"; // set default text color and background color for tooltip here // individual tooltips can have their own (set in messages arrays) // but don't have to var tipFontColor = "#cccccc"; var tipBgColor = "#ffffff"; var tipBorderColor = "#999999"; var tipBorderWidth = 1; var tipBorderStyle = "solid"; var tipPadding = 0; // tooltip content goes here (image, description, optional bgColor, optional textcolor) // multi-dimensional arrays containing: // image and text for tooltip // optional: bgColor and color to be sent to tooltip // to layout image and text, 2-row table, image centered in top cell // these go in var tip in doTooltip function // startStr goes before image, midStr goes between image and text var startStr = '
'; //////////////////////////////////////////////////////////// // initTip - initialization for tooltip. // Global variables for tooltip. // Set styles // Set up mousemove capture if tipFollowMouse set true. //////////////////////////////////////////////////////////// var tooltip, tipcss; function initTip() { if (nodyn) return; tooltip = (ie4) ? document.all['tipDiv'] : (ie5 || ns5) ? document.getElementById('tipDiv') : null; tipcss = tooltip.style; if (ie4 || ie5 || ns5) { // ns4 would lose all this on rewrites tipcss.width = tipWidth + "px"; tipcss.fontFamily = tipFontFamily; tipcss.fontSize = tipFontSize; tipcss.color = tipFontColor; tipcss.backgroundColor = tipBgColor; tipcss.borderColor = tipBorderColor; tipcss.borderWidth = tipBorderWidth + "px"; tipcss.padding = tipPadding + "px"; tipcss.borderStyle = tipBorderStyle; } if (tooltip && tipFollowMouse) { document.onmousemove = trackMouse; } } window.onload = initTip; ///////////////////////////////////////////////// // doTooltip function // Assembles content for tooltip and writes // it to tipDiv ///////////////////////////////////////////////// var t1, t2; // for setTimeouts var tipOn = false; // check if over tooltip link function doTooltip(evt, messages) { if (!tooltip) return; if (t1) clearTimeout(t1); if (t2) clearTimeout(t2); tipOn = true; // set colors if included in messages array curBgColor = tipBgColor; curFontColor = tipFontColor; if (ie4 || ie5 || ns5) { var tip = startStr + messages + midStr + '' + '' + '' + endStr; tipcss.backgroundColor = curBgColor; tooltip.innerHTML = tip; } if (!tipFollowMouse) positionTip(evt); else t1 = setTimeout("tipcss.visibility='visible'", 100); } var mouseX, mouseY; function trackMouse(evt) { standardbody = (document.compatMode == "CSS1Compat") ? document.documentElement : document.body //create reference to common "body" across doctypes mouseX = (ns5) ? evt.pageX : window.event.clientX + standardbody.scrollLeft; mouseY = (ns5) ? evt.pageY : window.event.clientY + standardbody.scrollTop; if (tipOn) positionTip(evt); } ///////////////////////////////////////////////////////////// // positionTip function // If tipFollowMouse set false, so trackMouse function // not being used, get position of mouseover event. // Calculations use mouseover event position, // offset amounts and tooltip width to position // tooltip within window. ///////////////////////////////////////////////////////////// function positionTip(evt) { if (!tipFollowMouse) { mouseX = (ns5) ? evt.pageX : window.event.clientX + standardbody.scrollLeft; mouseY = (ns5) ? evt.pageY : window.event.clientY + standardbody.scrollTop; } // tooltip width and height var tpWd = (ie4 || ie5) ? tooltip.clientWidth : tooltip.offsetWidth; var tpHt = (ie4 || ie5) ? tooltip.clientHeight : tooltip.offsetHeight; // document area in view (subtract scrollbar width for ns) var winWd = (ns5) ? window.innerWidth - 20 + window.pageXOffset : standardbody.clientWidth + standardbody.scrollLeft; var winHt = (ns5) ? window.innerHeight - 20 + window.pageYOffset : standardbody.clientHeight + standardbody.scrollTop; // check mouse position against tip and window dimensions // and position the tooltip if ((mouseX + offX + tpWd) > winWd) tipcss.left = mouseX - (tpWd + offX) + "px"; else tipcss.left = mouseX + offX + "px"; if ((mouseY + offY + tpHt) > winHt) tipcss.top = winHt - (tpHt + offY) + "px"; else tipcss.top = mouseY + offY + "px"; if (!tipFollowMouse) t1 = setTimeout("tipcss.visibility='visible'", 100); } function hideTip() { if (!tooltip) return; t2 = setTimeout("tipcss.visibility='hidden'", 100); tipOn = false; } document.write('
') function proinfo(prod, cpath, name) { var tmp; //alert(prod); var newwindow; $("#buyForm").attr("action", './product_info.php?products_id=' + prod + '&kind=2&cPath=' + cpath + '&description=' + name); $("#buyForm").attr("method", 'post'); $("#buyForm").submit(); } function shopcart() { var tmp; //alert(prod); var newwindow; document.buy_now_.action = './shopping_cart.php?kind=2'; //document.buy_now_.kind.value = 2 document.buy_now_.method = 'post'; document.buy_now_.submit(); //newwindow=window.open('./ .php?products_id='+prod,'name','height=600,width=700,scrollbars=yes,resizable=yes,screenY=100,top=150,left=300'); // if (window.focus) {newwindow.focus()} } function check_cart() { var count = 0; $(".productListing select").each(function () { if ($(this).val() > 0) { count += parseInt($(this).val()); } }); var cart_content = $("#cart_content").val(); if ((count + parseInt(cart_content)) > 700) { alert("You have too many products in the shopping cart. Please checkout first."); return false; } else if (count == 0) { alert("Quantity must be greater than 0!"); return false; } $("#add_cart_action").val("add_mutiple"); var formData = $("#buyForm").serialize(); $.ajax({ type: "POST", url: "m.cart_action.php", cache: false, dataType: "json", data: formData, success: function (cart) { $("#buyForm").find("select").each(function () { if ($(this).val() > 0) { var text = ""; var pid = $(this).attr("name"); pid = pid.substring(pid.lastIndexOf("_") + 1); for (var i = 0; i < cart.length; i++) { var temp_id = cart[i].productId + ""; if (pid == temp_id) { text = cart[i].text; break; } } $(this).parent().parent().parent().find(".cart_info").show().text(text); $(this).val(0); } }); $("#resultDiv").load("m.cart_action.php?action=load_cart"); }, error: function (request, error) { alert("There is some error, please choose again."); document.location.reload(true); } }); } function check_wish() { var count = 0; $(".productListing select").each(function () { if ($(this).val() > 0) { count += parseInt($(this).val()); } }); if (count == 0) { alert("Quantity must be greater than 0!"); return false; } $("#add_cart_action").val("add_wish_multiple"); var formData = $("#buyForm").serialize(); $.ajax({ type: "POST", url: "m.cart_action.php", cache: false, dataType: "json", data: formData, success: function (cart) { $("#buyForm").find("select").each(function () { if ($(this).val() > 0) { var text = ""; var pid = $(this).attr("name"); pid = pid.substring(pid.lastIndexOf("_") + 1); for (var i = 0; i < cart.length; i++) { var temp_id = cart[i].productId + ""; if (pid == temp_id) { text = cart[i].text; break; } } $(this).parent().parent().parent().find(".wish_info").show().text(text); $(this).val(0); } }); iosOverlay({ text: "Added to WISH LIST!", duration: 2e3 }); }, error: function (request, error) { alert("There is some error, please choose again."); document.location.reload(true); } }); } function add_cart(prodId, unit) { $("#addProductId").val(prodId); unit $("#unit").val(unit); var goThrough = true; var count = 0; if (unit == "pc") { if (parseInt($('select[name="Qty_ProdId_' + prodId + '"]').val()) == 0) { goThrough = false; } else { count = parseInt($('select[name="Qty_ProdId_' + prodId + '"]').val()); } } else { if (parseInt($('select[name="Qty_ZPrdId_' + prodId + '"]').val()) == 0) { goThrough = false; } else { count = parseInt($('select[name="Qty_ZPrdId_' + prodId + '"]').val()); } } /*if(parseInt($('select[name="Qty_ProdId_'+prodId+'"]').val()) == 0) { goThrough = false; if ($('select[name="Qty_ZPrdId_'+prodId+'"]')) { if(parseInt($('select[name="Qty_ZPrdId_'+prodId+'"]').val()) > 0) { goThrough = true; } } }*/ var cart_content = $("#cart_content").val(); if ((parseInt(cart_content) + 1) > 700) { alert("You have too many products in the shopping cart. Please checkout first."); return; } if (!goThrough) { alert("Quantity must be greater than 0!"); return; } $("#cart_content").val(parseInt(cart_content) + 1); $("#add_cart_action").val("add_to_cart"); var formData = $("#buyForm").serialize(); $.ajax({ type: "POST", url: "m.cart_action.php", cache: false, data: formData, success: function (data) { if (unit == "pc") { $('select[name="Qty_ProdId_' + prodId + '"]').val(0); } else { if ($('select[name="Qty_ZPrdId_' + prodId + '"]')) { $('select[name="Qty_ZPrdId_' + prodId + '"]').val(0); } } $('select[name="Qty_ProdId_' + prodId + '"]').parent().parent().parent().find(".cart_info").show().text(data); $("#resultDiv").load("m.cart_action.php?action=load_cart"); }, error: function (request, error) { alert("There is some error, please choose again."); document.location.reload(true); } }); } function add_wish(prodId, unit) { $("#addProductId").val(prodId); unit $("#unit").val(unit); var goThrough = true; if (unit == "pc") { if (parseInt($('select[name="Qty_ProdId_' + prodId + '"]').val()) == 0) { goThrough = false; } } else { if (parseInt($('select[name="Qty_ZPrdId_' + prodId + '"]').val()) == 0) { goThrough = false; } } /*if(parseInt($('select[name="Qty_ProdId_'+prodId+'"]').val()) == 0) { goThrough = false; if ($('select[name="Qty_ZPrdId_'+prodId+'"]')) { if(parseInt($('select[name="Qty_ZPrdId_'+prodId+'"]').val()) > 0) { goThrough = true; } } }*/ if (!goThrough) { alert("Quantity must be greater than 0!"); return; } $("#add_cart_action").val("add_to_wish"); var formData = $("#buyForm").serialize(); // alert(formData); $.ajax({ type: "POST", url: "m.cart_action.php", cache: false, data: formData, success: function (data) { if (unit == "pc") { $('select[name="Qty_ProdId_' + prodId + '"]').val(0); } else { if ($('select[name="Qty_ZPrdId_' + prodId + '"]')) { $('select[name="Qty_ZPrdId_' + prodId + '"]').val(0); } } $('select[name="Qty_ProdId_' + prodId + '"]').parent().parent().parent().find(".alert_info").show().text(data); iosOverlay({ text: "Added to WISH LIST!", duration: 2e3, }); }, error: function (request, error) { alert("There is some error, please choose again."); document.location.reload(true); } }); } function add_req(prodId, unit) { $('#myModal1').modal('show'); $('#ok-button').click(function() { $(function() { $('#myModal1').modal('hide'); }); $("#addProductId").val(prodId); unit $("#unit").val(unit); var goThrough = true; if (unit == "pc") { if (parseInt($('select[name="Qty_ProdId_' + prodId + '"]').val()) == 0) { goThrough = false; } } else { if (parseInt($('select[name="Qty_ZPrdId_' + prodId + '"]').val()) == 0) { goThrough = false; } } if (!goThrough) { alert("Quantity must be greater than 0!"); return; } $("#add_cart_action").val("add_to_req"); var formData = $("#buyForm").serialize(); $.ajax({ type: "POST", url: "m.cart_action.php", cache: false, data: formData, success: function (data) { if (unit == "pc") { $('select[name="Qty_ProdId_' + prodId + '"]').val(0); } else { if ($('select[name="Qty_ZPrdId_' + prodId + '"]')) { $('select[name="Qty_ZPrdId_' + prodId + '"]').val(0); } } $('select[name="Qty_ProdId_' + prodId + '"]').parent().parent().parent().find(".alert_info").show().text(data); iosOverlay({ text: "REQUESTED!", duration: 2e3, }); }, error: function (request, error) { alert("There is some error, please choose again."); document.location.reload(true); } }); }); }
|