
jQuery.fn.CustomCheckboxes=function(settings){settings=jQuery.extend({checkboxWidth:24,checkboxHeight:20,className:'customCheckboxes',display:'list'},settings);$(this).each(function(){$label=$('label[for="'+$(this).attr('id')+'"]');$label.prepend("<span class='holderWrap'><span class='holder'></span></span>");if($(this).is(':checked')){$label.addClass('checked');};$label.addClass(settings.className).addClass($(this).attr('type')).addClass(settings.display);$label.find('span.holderWrap').width(settings.checkboxWidth).height(settings.checkboxHeight);$label.find('span.holder').width(settings.checkboxWidth);$(this).addClass('hiddenCheckbox');$label.bind('click',function(){$('input#'+$(this).attr('for')).triggerHandler('click');if($('input#'+$(this).attr('for')).is(':checkbox')){$(this).toggleClass('checked');$('input#'+$(this).attr('for')).checked=true;$(this).find('span.holder').css('top',0);}else{$toCheck=$('input#'+$(this).attr('for'));$('input[name="'+$toCheck.attr('name')+'"]').each(function(){$('label[for="'+$(this).attr('id')+'"]').removeClass('checked');});$(this).addClass('checked');$toCheck.checked=true;};});$('input#'+$label.attr('for')).bind('keypress',function(e){if(e.keyCode==32){if($.browser.msie){$('label[for="'+$(this).attr('id')+'"]').toggleClass("checked");}else{$(this).trigger('click');}
return false;};});});};checkAllCustomCheckboxes=function(caller,container){if($(caller).is(':checked')){$(container).find('input[type=checkbox]:not(:checked)').each(function(){$('label[for="'+$(this).attr('id')+'"]').trigger('click');if($.browser.msie){$(this).attr('checked','checked');}else{$(this).trigger('click');};});}else{$(container).find('input[type=checkbox]:checked').each(function(){$('label[for="'+$(this).attr('id')+'"]').trigger('click');if($.browser.msie){$(this).attr('checked','');}else{$(this).trigger('click');};});};};function swap_btn_hover(strIz,strDe){document.getElementById(strIz).className='imgBtnLeftStdHover';document.getElementById(strDe).className='imgBtnRightStdHover';document.getElementById(strIz).className='imgBtnLeftStdHover';document.getElementById(strDe).className='imgBtnRightStdHover';}
function swap_btn_out(strIz,strDe){document.getElementById(strIz).className='imgBtnLeftStd';document.getElementById(strDe).className='imgBtnRightStd';document.getElementById(strIz).className='imgBtnLeftStd';document.getElementById(strDe).className='imgBtnRightStd';}
function IntegerAndDecimal(e,obj,isDecimal){if([e.keyCode||e.which]==8)
return true;if([e.keyCode||e.which]==9)
return true;if(isDecimal=='true'){if([e.keyCode||e.which]==44)
{var val=obj.value;if(val.indexOf(",")>-1){e.returnValue=false;return false;}
return true;}}
if([e.keyCode||e.which]<48||[e.keyCode||e.which]>57)
e.preventDefault?e.preventDefault():e.returnValue=false;}
function AlphaNumericOnly(e,isAlphaonly){var key=[e.keyCode||e.which];var keychar=String.fromCharCode([e.keyCode||e.which]);keychar=keychar.toLowerCase();if(isAlphaonly=='true')
checkString="abcdefghijklmnopqrstuvwxyz";else
checkString="abcdefghijklmnopqrstuvwxyz0123456789";if((key==null)||(key==0)||(key==8)||(key==9)||(key==13)||(key==27))
return true;else if(((checkString).indexOf(keychar)>-1))
return true;else
return false;}
function callOnload(){$("input[isRequired=true]").each(function(n){$('#'+this.id).addClass('mandatory');if(this.value===''){$('#'+this.id).removeClass('normal');$('#'+this.id).addClass('mandatory');}
else{$('#'+this.id).removeClass('mandatory');$('#'+this.id).addClass('normal');}});$("textarea[isRequired=true]").each(function(n){$('#'+this.id).addClass('mandatory');if(this.value===''){$('#'+this.id).removeClass('normal');$('#'+this.id).addClass('mandatory');}
else{$('#'+this.id).removeClass('mandatory');$('#'+this.id).addClass('normal');}});showWaterMark();}
var watermark="";function showWaterMark(){$("input[ShowWaterMark=True]").each(function(n){showWaterMarkText(this.id);$('#'+this.id).focus(function(){test=watermark+$('#'+this.id).attr("LabelValue");if(this.value==test){this.value="";}});});$("textarea[ShowWaterMark=True]").each(function(n){showWaterMarkText(this.id);$('#'+this.id).focus(function(){test=watermark+$('#'+this.id).attr("LabelValue");if(this.value==test){this.value="";}});});}
function showWaterMarkText(id){}
function keyup(cid){var showWaterMark=$('#'+cid).attr("ShowWaterMark");if(showWaterMark==="True")
test=watermark+$('#'+cid).attr("LabelValue");else
test='';if($('#'+cid).val()===''||$('#'+cid).val()===test){document.getElementById('spError'+cid).style.display='block';$('#'+cid).removeClass('normal');$('#'+cid).addClass('mandatory');}
else{document.getElementById('spError'+cid).style.display='none';$('#'+cid).removeClass('mandatory');$('#'+cid).addClass('normal');}
if(showWaterMark==="True")
showWaterMarkText(cid);}
function CountText(field,maxlimit){if(field.value.length<maxlimit)
{return true;}
else
return false;}
function checkReg(obj,pattern){if(obj.value!==''&&pattern!==''){var pattern1=new RegExp(pattern);if(obj.value.match(pattern1)){document.getElementById('spCuError'+obj.id).style.display='none';return true;}
else{document.getElementById('spCuError'+obj.id).style.display='block';return false;}}}
function validateFormInputs(gropId){var isAllValid=true;var searchConditon="";if(gropId!==""&&gropId!==undefined){searchConditon=searchConditon+"input[isRequired=true][GroupId="+gropId+"]";}
else{searchConditon=searchConditon+"input[isRequired=true]";}
$(searchConditon).each(function(n){test=watermark+$('#'+this.id).attr("LabelValue");if(this.value===''||this.value==test){isAllValid=false;document.getElementById('spError'+this.id).style.display='block';}
else{if(this.pattern!==''&&this.pattern!==undefined){if(!checkReg(this,this.pattern)){isAllValid=false;}}
if(document.getElementById('spError'+this.id)!=null)
document.getElementById('spError'+this.id).style.display='none';}});searchConditon="";if(gropId!==""&&gropId!==undefined){searchConditon=searchConditon+"textarea[isRequired=true][GroupId="+gropId+"]";}
else{searchConditon=searchConditon+"textarea[isRequired=true]";}
$(searchConditon).each(function(n){test=watermark+$('#'+this.id).attr("LabelValue");if(this.value===''||this.value==test){isAllValid=false;document.getElementById('spError'+this.id).style.display='block';}
else{if(document.getElementById('spError'+this.id)!=null)
document.getElementById('spError'+this.id).style.display='none';}});return isAllValid;}
function ldi(objimg){objimg.src="/img/1x1.gif";}
function loaddefimages(objimg)
{objimg.src="/img/1x1.gif";}
var month='0';var day='27';var dow=0;var hour=14;var min=0;var tz=10;var lab='cd';var ahoras=new Array(10);var aminutos=new Array(10);var aidx=0;var amsg="";function start(){displayCountdown(setCountdown(month,day,hour,min,tz),lab);}
function addAlert(iidx,ihora,iminuto){ahoras[iidx]=ihora;aminutos[iidx]=iminuto;aidx+=1;}
function resetAlerts(){var i=0;for(i=0;i<aidx;i++)
{ahoras[i]=0;aminutos[i]=0;}
aidx=0;}
var pageLoaded=0;window.onload=function(){pageLoaded=1;}
function loaded(i,f){if(document.getElementById&&document.getElementById(i)!=null)f();else if(!pageLoaded)setTimeout('loaded(\''+i+'\','+f+')',100);}
function setCountdown(pmonth,pday,phour,pmin,ptz){month=pmonth;day=pday;hour=phour;min=pmin;tz=ptz;var m=month;if(month=='*')m=0;var c=setC(m,day,hour,tz);if(month=='*'&&c<0)c=setC('*',day,hour,tz);return c;}
function setC(month,day,hour,tz){var toDate=new Date();if(day.substr(0,1)=='+'){var day1=parseInt(day.substr(1));toDate.setDate(toDate.getDate()+day1);}
else
{toDate.setDate(day);}
if(month>0){if(month<=toDate.getMonth())toDate.setFullYear(toDate.getFullYear()+1);toDate.setMonth(month-1);}
if(dow>0)toDate.setDate(toDate.getDate()+(dow-1-toDate.getDay())%7);toDate.setHours(hour);toDate.setMinutes(min-(tz*60));toDate.setSeconds(0);var fromDate=new Date();fromDate.setMinutes(fromDate.getMinutes());var diffDate=new Date(0);diffDate.setMilliseconds(toDate-fromDate);return Math.floor(diffDate.valueOf()/1000);}
function stoper(){try{clearTimeout(timer);}
catch(error){}}
function displayCountdown(countdn,cd){if(countdn<0){document.getElementById(cd).innerHTML="...";try{__doPostBack('ctl00$mc$bhCerrarPedido','')}
catch(error){}}
else{var secs=countdn%60;if(secs<10)secs='0'+secs;var countdn1=(countdn-secs)/60;var mins=countdn1%60;if(mins<10)mins='0'+mins;countdn1=(countdn1-mins)/60;var hours=countdn1%24;var days=(countdn1-hours)/24;if(days==0){for(i=0;i<aidx;i++){if(ahoras[i]==hours&&aminutos[i]==mins&&(secs==02||secs==01)){try{ if(hours==0) amsg=amsg.replace("HH horas y ","").replace("HH hores i ",""); amsg=amsg.replace("HH",hours);amsg=amsg.replace("MM",mins);mostrarAlerta(amsg);}
catch(error){alert("No se puede mostrar la capa");}}else{}}}
if(days>=1){document.getElementById(cd).innerHTML=days+'D, '+hours+'h:'+mins+'m';setTimeout('displayCountdown('+(countdn-1)+',\''+cd+'\');',999);}else{document.getElementById(cd).innerHTML=hours+'h:'+mins+'m';setTimeout('displayCountdown('+(countdn-1)+',\''+cd+'\');',999);}}}
(function(){function loadScroll(){var cookieList=document.cookie.split(';');for(var i=0;i<cookieList.length;i++){var cookieParts=cookieList[i].split('=');if(cookieParts[0]=='scrollPosition'){var values=unescape(cookieParts[1]).split('/');for(var j=0;j<values.length;j++){var currentValue=values[j].split(',');try{if(currentValue[0]=='window'){window.scrollTo(currentValue[1],currentValue[2]);}else if(currentValue[0]){var elm=document.getElementById(currentValue[0]);elm.scrollLeft=currentValue[1];elm.scrollTop=currentValue[2];}}catch(ex){}}
return;}}}
function saveScroll(){var s='scrollPosition=';var wl,wt;if(window.pageXOffset!==undefined){wl=window.pageXOffset;wt=window.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollLeft!==undefined){wl=document.documentElement.scrollLeft;wt=document.documentElement.scrollTop;}else{wl=document.body.scrollLeft;wt=document.body.scrollTop;}
if(wl||wt){s+='window,'+wl+','+wt+'/';}
var elements=(document.all)?document.all:document.getElementsByTagName('*');for(var i=0;i<elements.length;i++){var e=elements[i];if(e.id&&(e.scrollLeft||e.scrollTop)){s+=e.id+','+e.scrollLeft+','+e.scrollTop+'/';}}
document.cookie=s+';';}
var addEvent,eventPrefix;if(window.attachEvent){addEvent=window.attachEvent;eventPrefix='on';}else{addEvent=window.addEventListener;eventPrefix='';}
addEvent(eventPrefix + 'load', function() { loadScroll(); if (typeof Sys != 'undefined' && typeof Sys.WebForms != 'undefined') { Sys.WebForms.PageRequestManager.getInstance().add_endRequest(loadScroll); Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(saveScroll); } }, false); addEvent(eventPrefix + 'unload', saveScroll, false);
})(); function ShowModalDiv(id, x, y)
{var maskHeight=$(document).height()-10;var maskWidth=$(window).width()-10;$('#mask').css({'width':maskWidth,'height':maskHeight});$('#mask').fadeIn(10);$(id).css('top',y);$(id).css('left',x);$(id).fadeIn(800);}
function ShowCentrarModalDiv(id){var maskHeight=$(document).height();var maskWidth=$(window).width();var winH=$(window).height();$('#mask').css({'width':maskWidth,'height':maskHeight});$('#mask').fadeIn(100);$(id).css('top',winH/2-$(id).height()/2);$(id).css('left',maskWidth/2-$(id).width()/2);$(id).fadeIn(800);}
function calculoSize() {var myHeight = 0;if( typeof( window.innerWidth ) == 'number' ) {myHeight = window.innerHeight;} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {myHeight = document.documentElement.clientHeight;} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {myHeight = document.body.clientHeight;} return myHeight;}
