//timers
jQuery.fn.extend({everyTime:function(b,a,c,d,e){return this.each(function(){jQuery.timer.add(this,b,a,c,d,e)})},oneTime:function(b,a,c){return this.each(function(){jQuery.timer.add(this,b,a,c,1)})},stopTime:function(b,a){return this.each(function(){jQuery.timer.remove(this,b,a)})}}); jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1E3,das:1E4,hs:1E5,ks:1E6},timeParse:function(b){if(b==undefined||b==null)return null;var a=this.regex.exec(jQuery.trim(b.toString()));return a[2]?parseInt(a[1],10)*(this.powers[a[2]]||1):b},add:function(b,a,c,d,e,f){var g=0;if(jQuery.isFunction(c)){e||(e=d);d=c;c=a}a=jQuery.timer.timeParse(a);if(!(typeof a!="number"||isNaN(a)||a<=0)){if(e&&e.constructor!=Number){f=!!e;e=0}e=e||0;f=f||false;if(!b.$timers)b.$timers= {};b.$timers[c]||(b.$timers[c]={});d.$timerID=d.$timerID||this.guid++;var h=function(){if(!(f&&this.inProgress)){this.inProgress=true;if(++g>e&&e!==0||d.call(b,g)===false)jQuery.timer.remove(b,c,d);this.inProgress=false}};h.$timerID=d.$timerID;b.$timers[c][d.$timerID]||(b.$timers[c][d.$timerID]=window.setInterval(h,a));this.global[c]||(this.global[c]=[]);this.global[c].push(b)}},remove:function(b,a,c){var d=b.$timers,e;if(d){if(a){if(d[a]){if(c){if(c.$timerID){window.clearInterval(d[a][c.$timerID]); delete d[a][c.$timerID]}}else for(c in d[a]){window.clearInterval(d[a][c]);delete d[a][c]}for(e in d[a])break;if(!e){e=null;delete d[a]}}}else for(a in d)this.remove(b,a,c);for(e in d)break;if(!e)b.$timers=null}}}});jQuery.browser.msie&&jQuery(window).one("unload",function(){var b=jQuery.timer.global;for(var a in b)for(var c=b[a],d=c.length;--d;)jQuery.timer.remove(c[d],a)});

//corners
(function(d){d.fn.corner=function(f){function o(a,g){return parseInt(d.css(a,g))||0}function m(a){a=parseInt(a).toString(16);return a.length<2?"0"+a:a}function r(a){for(;a&&a.nodeName.toLowerCase()!="html";a=a.parentNode){var g=d.css(a,"backgroundColor");if(g.indexOf("rgb")>=0){if(d.browser.safari&&g=="rgba(0, 0, 0, 0)")continue;a=g.match(/\d+/g);return"#"+m(a[0])+m(a[1])+m(a[2])}if(g&&g!="transparent")return g}return"#ffffff"}function s(a){switch(t){case "round":return Math.round(b*(1-Math.cos(Math.asin(a/ b))));case "cool":return Math.round(b*(1+Math.cos(Math.asin(a/b))));case "sharp":return Math.round(b*(1-Math.cos(Math.acos(a/b))));case "bite":return Math.round(b*Math.cos(Math.asin((b-a-1)/b)));case "slide":return Math.round(b*Math.atan2(a,b/a));case "jut":return Math.round(b*Math.atan2(b,b-a-1));case "curl":return Math.round(b*Math.atan(a));case "tear":return Math.round(b*Math.cos(a));case "wicked":return Math.round(b*Math.tan(a));case "long":return Math.round(b*Math.sqrt(a));case "sculpt":return Math.round(b* Math.log(b-a-1,b));case "dog":return a&1?a+1:b;case "dog2":return a&2?a+1:b;case "dog3":return a&3?a+1:b;case "fray":return a%2*b;case "notch":return b;case "bevel":return a+1}}var p=d.browser.msie&&/MSIE 6.0/.test(navigator.userAgent);f=(f||"").toLowerCase();var u=/keep/.test(f),v=(f.match(/cc:(#[0-9a-f]+)/)||[])[1],w=(f.match(/sc:(#[0-9a-f]+)/)||[])[1],b=parseInt((f.match(/(\d+)px/)||[])[1])||10,t=(f.match(/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/)|| ["round"])[0],q={T:0,B:1},e={TL:/top|tl/.test(f),TR:/top|tr/.test(f),BL:/bottom|bl/.test(f),BR:/bottom|br/.test(f)};if(!e.TL&&!e.TR&&!e.BL&&!e.BR)e={TL:1,TR:1,BL:1,BR:1};var h=document.createElement("div");h.style.overflow="hidden";h.style.height="1px";h.style.backgroundColor=w||"transparent";h.style.borderStyle="solid";return this.each(function(){var a={T:parseInt(d.css(this,"paddingTop"))||0,R:parseInt(d.css(this,"paddingRight"))||0,B:parseInt(d.css(this,"paddingBottom"))||0,L:parseInt(d.css(this, "paddingLeft"))||0};if(d.browser.msie)this.style.zoom=1;if(!u)this.style.border="none";h.style.borderColor=v||r(this.parentNode);var g=d.curCSS(this,"height");for(var k in q){var i=q[k];if(i&&(e.BL||e.BR)||!i&&(e.TL||e.TR)){h.style.borderStyle="none "+(e[k+"R"]?"solid":"none")+" none "+(e[k+"L"]?"solid":"none");var j=document.createElement("div");d(j).addClass("jquery-corner");var c=j.style;i?this.appendChild(j):this.insertBefore(j,this.firstChild);if(i&&g!="auto"){if(d.css(this,"position")=="static")this.style.position= "relative";c.position="absolute";c.bottom=c.left=c.padding=c.margin="0";if(d.browser.msie)c.setExpression("width","this.parentNode.offsetWidth");else c.width="100%"}else if(!i&&d.browser.msie){if(d.css(this,"position")=="static")this.style.position="relative";c.position="absolute";c.top=c.left=c.right=c.padding=c.margin="0";var l=0;if(p||!d.boxModel)l=o(this,"borderLeftWidth")+o(this,"borderRightWidth");p?c.setExpression("width","this.parentNode.offsetWidth - "+l+'+ "px"'):(c.width="100%")}else c.margin= !i?"-"+a.T+"px -"+a.R+"px "+(a.T-b)+"px -"+a.L+"px":a.B-b+"px -"+a.R+"px -"+a.B+"px -"+a.L+"px";for(c=0;c<b;c++){l=Math.max(0,s(c));var n=h.cloneNode(false);n.style.borderWidth="0 "+(e[k+"R"]?l:0)+"px 0 "+(e[k+"L"]?l:0)+"px";i?j.appendChild(n):j.insertBefore(n,j.firstChild)}}}})};d.fn.uncorner=function(){return d(".jquery-corner",this).remove()}})(jQuery);


//form validate
(function(a){a.fn.extend({formValidate:function(){return this.each(function(){var b=a(this);b.children('input[type="text"],input[type="password"],textarea').val("");b.children('input[type="text"]').focus(function(){thsInp=a(this);thsInpVal=thsInp.val();thsInp.val("")}).blur(function(){thsInpVal2=thsInp.val();thsInpVal2==""&&thsInp.val(thsInpVal)});b.children(".mand").keyup(function(){a(this).validateElm()}).focus(function(){a(this).validateElm()}).blur(function(){a(this).validateElm()})})},validateElm:function(){thsNme=
a(this).attr("name");thsVal=strTrim(a(this).val());thsElm=a(this);emlValBool=false;if(thsNme!=""){typeSpl=thsNme.split("_");if(typeSpl[0]=="text"){if(thsVal!="")emlValBool=true}else if(typeSpl[0]=="hidden"){if(thsVal=="")emlValBool=true}else if(typeSpl[0]=="email"){if(CheckEmail(thsVal))emlValBool=true}else if(typeSpl[0]=="number")if(isNumeric(thsVal)&&typeSpl[1]==undefined)emlValBool=true;else{if(isNumeric(thsVal)&&thsVal.length>=parseInt(typeSpl[1]))emlValBool=true}else if(typeSpl[0]=="password")if(typeSpl[1]==
1&&thsVal!="")emlValBool=true;else if(thsElm.parent().children('input[type="password"]').eq(0).val()=="")emlValBool=false;else if(typeSpl[1]==2&&thsElm.parent().children('input[type="password"]').eq(0).val()==thsVal)emlValBool=true;if(emlValBool){thsElm.inpValid({valid:true});return emlValBool}else thsElm.inpValid()}},inpValid:function(b){b=a.extend({valid:false},b);frmObj=a(this);if(b.valid){bgCol="#e9ffd3";BordCol="#cdf4a6"}else{bgCol="#fef0e6";BordCol="#fbceb0"}frmObj.css({backgroundColor:bgCol,
borderColor:BordCol})},frmSubmit:function(){thsForm=a(this).children(".mand");elmCount=thsForm.size();elmC=0;thsForm.each(function(){a(this).validateElm()&&elmC++});if(elmC==elmCount)return true},frmReset:function(){a(this).children(".mand").css({backgroundColor:"#fff",borderColor:"#e9e6fe"})}})})(jQuery);
function CheckEmail(a){rEgArr=["com","net","org","us","biz","info","co.uk","org.uk","ca"];returnBool=false;AtPos=a.indexOf("@");StopPos=a.lastIndexOf(".");for(i=0;i<=rEgArr.length;i++){regArrIndx=a.indexOf(rEgArr[i]);if(regArrIndx!=-1)returnBool=true}return AtPos==-1||StopPos==-1||!returnBool?false:true}function strTrim(a){return a.split(" ").join("")}
function isNumeric(a){strValidChars="0123456789";returnBool=true;if(a.length==0)returnBool=false;for(i=0;i<=a.length&&returnBool==true;i++){strChar=a.charAt(i);if(strValidChars.indexOf(strChar)==-1)returnBool=false}return returnBool};

