File: /home/durgeshpandey215/public_html/zeeroprice.skilladders.com/js/functions.js
$(document).ready(function(){
var HTTP_SERVER_JQUERY = $('#HTTP_SERVER').val(); //this #id is in footer
$('.msg').delay(15000).fadeOut();//hide msg after 15 seconds
//follwoing is for Class commonform
$('.commonform').on('submit', function(event) {
//alert($(this).find('input[type="submit"]').val());
$(this).find('.submitbutton').prop('value','Processing...');
$(this).find('.submitbutton').prop('disabled', true);
//event.preventDefault();
return;
});
//follwoing is for ID commonform
$('#commonform').on('submit', function(event) {
//alert($(this).find('input[type="submit"]').val());
$(this).find('input[type="submit"]').prop('value','Processing...');
$(this).find('input[type="submit"]').prop('disabled', true);
//alert($(this).find('input[type="submit"]').val());
return;
});
$('.noteicon').click(function(){
if($('.tip').css('display')=="none"){
$('.tip').show('slow');
}else{
$('.tip').hide('slow');
}
return;
});
$('#coupon').on('blur', function() {
$.ajax({url:HTTP_SERVER_JQUERY+"ajax-couponvalidate.php?val="+$('#coupon').val(), success:function(result){
if(result == 0){
alert('Invalid Coupon');
$('#coupon').val('');
} F
}});
});
$("#counrtyid").change(function(){
var counrtyid = $("#counrtyid").val();
if(counrtyid != 'India'){
$("#stateDiv").html("");
$("#districtDiv").html("");
}else{
var isclass = $('#counrtyid').attr('class');
$("#stateDiv").html("<select class='"+isclass+"' style='min-width:175px;'><option>Loading...</option></select>");
var urlvar = HTTP_SERVER_JQUERY+"ajax-states.php";
//alert(urlvar);
$.ajax({url:urlvar, success:function(result){ $("#stateDiv").html(result);}, error:function($result){ alert(result)} });
}
});
$(document).on("change", '#stateid', function(event) {
var stateid = $("#stateid").val();
var isclass = $('#stateid').attr('class');
$("#districtDiv").html("<select class='"+isclass+"'><option>Loading...</option></select>");
var urlvar = HTTP_SERVER_JQUERY+"ajax-district.php?stateid="+stateid+"&isclass="+isclass;
//alert(urlvar);
$.ajax({url:urlvar, success:function(result){ $("#districtDiv").html(result);}, error:function($result){ alert(result)} });
});
$("#indextype").change(function(){
var marketname = $("#marketname").val();
$("#marketresultDiv").html("Loading");
var urlvar = HTTP_SERVER_JQUERY+"ajax-marketstats.php?marketname="+$('#marketname').val()+"&indextype="+$('#indextype').val();
//alert(urlvar);
$.ajax({url:urlvar, success:function(result){ $("#marketresultDiv").html(result);}, error:function($result){ alert(result)} });
});
});
function ajaxreqCall(){
$('#CostDiv').html('Processing...');
$.ajax({dataType : 'json',url:$('#HTTP_SERVER').val()+"ajax_showprice.php?id="+$('#pid').val(),
success: function(data){
iserror = 2;
if(data.error){
$('#CostDiv').html(data.error);
iserror = 1;
}else{
if(data.orderid){
//Check if user have orderid (only paid users get orderid)
costdivHTML = "";
if(data.reducedPrice==0){
costdivHTML += "Congratulations, You have unlocked the zeeroprice. Product is now free for you.";
}
costdivHTML += "<form action='"+$('#HTTP_SERVER').val()+"addtocart.php' method='post' id='commonform'>Zeero Price: <font class='price'>Rs."+data.reducedPrice+"</font><input type='hidden' name='type' value='add' /><input type='hidden' id='pid' name='pid' value='"+data.pid+"' /><input type='hidden' name='orderid' value='"+data.orderid+"'/><br/><br/><input type='submit' id='submitbutton' class='btn' value='Buy Now'></form>";
//add 4x silverCoin
$('.silverCoin').html(data.NewFreePoints);
}
$('#CostDiv').html(costdivHTML);
$('#walletSpan').html(data.pointsRemain);
$('#walletSpan2').html(data.pointsRemain);
var counter = 60;
var interval = setInterval(function() {
if (counter === 60) {
$('#timer').show('slow');
$('#time').text("1 min"); // Just "1 min" at the start
} else {
$('#time').text(counter + " sec");
}
counter--;
if (counter < 0) {
clearInterval(interval);
$('#timer').hide('slow');
// Close doors
$('#leftdoor').animate({ "width": "130px" }, "slow");
$('#rightdoor').animate({ "width": "130px" }, "slow");
// Show other content
$('#linkDiv').show('slow');
$('#CostDiv').html('');
}
}, 1000);
$('#intervalid').val(interval);
}
return iserror;
},
error: function(data){
console.log(data);
}
});
}
function ajaxreqFreeCall(vals){
if($('#timer').css('display') != 'none'){
alert("ZeeroPrice window is still open. Please wait till it closes.");
return;
}
var confirm = window.confirm( vals +' will be deducted from your Free Points \n Are you sure you want to continue?');
if (!confirm) {
return;
}
$('#CostDiv').html('Processing...');
$('#linkDiv').hide('slow');
//open door
$('#leftdoor').animate({"width": "5px"}, "slow");
$('#rightdoor').animate({"width": "5px"}, "slow");
$.ajax({dataType : 'json',url:$('#HTTP_SERVER').val()+"ajax_showprice-free.php?id="+$('#pid').val(),
success: function(data){
iserror = 2;
if(data.error){
$('#CostDiv').html(data.error);
iserror = 1;
}else{
costdivHTML = '<font class="price">Rs.' + data.reducedPrice +
'</font> <br/>To buy at Rs.' + data.reducedPrice + ', You must use PAID ZEEROPRICE GOLD COINS \n'+data.addNote;
$('#CostDiv').html(costdivHTML);
$('#freeSpan').html(data.pointsRemain);
$('#freeSpan2').html(data.pointsRemain);
var counter = 60;
var interval = setInterval(function() {
if (counter === 60) {
$('#timer').show('slow');
$('#time').text("1 min"); // Just "1 min" at the start
} else {
$('#time').text(counter + " sec");
}
counter--;
if (counter < 0) {
clearInterval(interval);
$('#timer').hide('slow');
// Close doors
$('#leftdoor').animate({ "width": "130px" }, "slow");
$('#rightdoor').animate({ "width": "130px" }, "slow");
// Show other content
$('#linkDiv').show('slow');
$('#CostDiv').html('');
}
}, 1000);
$('#intervalid').val(interval);
}
return iserror;
},
error: function(data){
console.log(data);
}
});
}
function clearinter(){
clearInterval($('#intervalid').val());
$('#timer').hide('slow');
//close door
$('#leftdoor').animate({"width": "130px"}, "slow");
$('#rightdoor').animate({"width": "130px"}, "slow");
$('#linkDiv').show('slow');
$('#CostDiv').html('');
return;
}
function changecaptcha(id){
var randnum = Math.random();
$('#'+id).attr("src", $('#HTTP_SERVER').val()+"generate.php?xy="+randnum);
}
function showhide(showid,hideid,extraid){
$('#'+hideid).hide();
$('#pic'+extraid).val('');
$('#'+showid).show();
}
function showhideDelete(showid,hideid,extraid,dbid){
$('#'+hideid).hide();
$('#pic'+extraid).val('');
$('#'+showid).show();
var callurl = $('#HTTP_SERVER').val()+"ajax_delpic.php?id="+extraid+"&dbid="+dbid;
$.ajax({url: callurl, success:function(result){
//alert(result);
}});
}
function showhideDeleteProfileEdit(showid,hideid,id,picno){
$('#'+hideid).hide();
$('#pic1').val('');
$('#'+showid).show();
var callurl = $('#HTTP_SERVER').val()+"ajax_relative-delpic.php?&id="+id+"&pic="+picno;
$.ajax({url: callurl, success:function(result){
}});
}
function showhideDeleteDP(showid,hideid,picnum,dbid){
$('#'+hideid).hide();
$('#pic'+picnum).val('');
$('#'+showid).show();
var callurl = $('#HTTP_SERVER').val()+"ajax_delpicDP.php?id="+picnum+"&dbid="+dbid;
$.ajax({url: callurl, success:function(result){
//alert(result);
}});
}
function checkuncheck(galleryid,isenlarge){//galleryid and isenlarge = 0:selection 1:Enlarge
if(isenlarge==0){ var inputid="selc"; }else{ var inputid="enlrg";}
if($('#'+inputid+galleryid).is(':checked')){
//alert('checked');
var ischecked = 1;
//Now make other checkbox unchecked
if(isenlarge=="0"){ //if select is checked
$('#selc'+galleryid).prop('checked', true);
$('#enlrg'+galleryid).prop('checked', false);
}else{//if enlarge is checked
$('#enlrg'+galleryid).prop('checked', true);
$('#enlrg2'+galleryid).prop('checked', true);
}
}else{ //alert('unchecked');
var ischecked = 0;
//Now make other checkbox unchecked
if(isenlarge=="0"){ //if select is unchecked
$('#selc'+galleryid).prop('checked', false);
}else{//if enlarge is unchecked
$('#enlrg'+galleryid).prop('checked', false);
}
}
var callurl = $('#HTTP_SERVER').val()+"ajax_selection.php?&galleryid="+galleryid+"&ischecked="+ischecked+"&isenlarge="+isenlarge;
//alert(callurl);
var totalchecked = $('input[type="checkbox"]:checked').length;
$('#selectedcount').text(totalchecked);
$.ajax({url: callurl, success:function(result){
//alert(result);
}});
}