/*
Project: 		Klein Lipo Site Content Element Controls
Author: 		Niń0 Morales
Date Created: 	Octover 15, 2010
*/

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.N.1k=6(){5.8().9();5.8().r(\'7\',[\'R\'])};$.N.1l=6(){5.8().9()};$.N.1m=6(a){5.8().9();5.8().V(\'7\');a=$.W(5.X(),a);5.Y(a)};$.N.1n=6(){5.8().9();5.8().w({s:0,t:0});5.8().V(\'7\')};$.N.Y=6(h){4 x={y:5};h=$.W({S:Z,10:\'11\',12:\'B\',P:\'1o\',13:\'T\',14:\'1p\',15:\'O\',16:\'O\',U:\'1q\'},h);4 i=z h.S==\'17\'?3(h.S):Z;4 j=h.10.E();4 k=h.12.E();4 l=z h.P==\'17\'&&h.P>0?3(h.P):-1;4 m=h.13.E();4 n=h.14.E();4 o=h.15.E();4 p=h.16.E();4 q=h.U.E();x.y.X(h);18();6 18(){x.y.w(\'U\',q);2(j==\'11\'){2(k!=\'B\'&&k!=\'t\'){k=\'B\'};19()}u{2(k!=\'F\'&&k!=\'s\'){k=\'F\'};1a()};2(n==\'O\'){x.y.1b(6(){$(5).8().9();$(5).8().r(\'7\',[\'R\'])})}u{x.y.1b(6(){$(5).8().9()})};2(o==\'O\'){x.y.1c(6(){$(5).8().9();$(5).8().r(\'7\',[\'R\'])})}u{x.y.1c(6(){$(5).8().9()})};2(p!=\'O\'){x.y.8().9()}};6 1a(){x.y.8().1d(\'7\',6(a,c){4 b=$(5);4 d=3(b.G().H());4 e=3(b.H());4 f=3(b.A().s);4 v=i>0&&i<C?(C-i)*C:1e;4 g=3(v*e/C)+v;2(m==\'Q\'){I(k){J\'F\':2(z c==\'D\'){b.w({s:d-e})};d=f-(e+d);K;L:2(z c==\'D\'){b.w({s:0})};d+=f+e}}u{I(k){J\'F\':2(z c==\'D\'){b.w({s:d});d=-e}u{d=f-(e+d)};K;L:2(z c==\'D\'){b.w({s:-e})}u{d+=f+e}}};2(l<0||l>0){2(l>0){l--};b.1f({s:d},{1g:g,1h:\'T\',1i:6(){b.r(\'7\')},1j:6(){I(m){J\'Q\':2(k==\'F\'){2(3(b.A().s)<=0){k=\'s\';b.9();b.r(\'7\')}}u{2(3(b.A().s)+3(b.H())>=3(b.G().H())){k=\'F\';b.9();b.r(\'7\')}};K;L:2(k==\'F\'){2(3(b.A().s)<-3(b.H())){b.9();b.r(\'7\')}}u{2(3(b.A().s)>3(b.G().H())){b.9();b.r(\'7\')}}}}})}}).r(\'7\')};6 19(){x.y.8().1d(\'7\',6(a,c){4 b=$(5);4 d=3(b.G().M());4 e=3(b.M());4 f=3(b.A().t);4 v=i>0&&i<C?(C-i)*C:1e;4 g=3(v*e/C)+v;2(m==\'Q\'){I(k){J\'B\':2(z c==\'D\'){b.w({t:d-e})};d=f-(e+d);K;L:2(z c==\'D\'){b.w({t:0})};d+=f+e}}u{I(k){J\'B\':2(z c==\'D\'){b.w({t:d});d=-e}u{d=f-(e+d)};K;L:2(z c==\'D\'){b.w({t:-e})}u{d+=f+e}}};2(l<0||l>0){2(l>0){l--};b.1f({t:d},{1g:g,1h:\'T\',1i:6(){b.r(\'7\')},1j:6(){I(m){J\'Q\':2(k==\'B\'){2(3(b.A().t)<=0){k=\'t\';b.9();b.r(\'7\')}}u{2(3(b.A().t)+3(b.M())>=3(b.G().M())){k=\'B\';b.9();b.r(\'7\')}};K;L:2(k==\'B\'){2(3(b.A().t)<-3(b.M())){b.9();b.r(\'7\')}}u{2(3(b.A().t)>3(b.G().M())){b.9();b.r(\'7\')}}}}})}}).r(\'7\')};1r 5}})(1s);',62,91,'||if|parseInt|var|this|function|marquee|children|stop||||||||||||||||||trigger|top|left|else||css|_|me|typeof|position|right|100|undefined|toLowerCase|bottom|parent|height|switch|case|break|default|width|fn|play|loop|pingpong|resume|velocity|linear|cursor|unbind|extend|data|SetScroller|50|direction|horizontal|startfrom|movetype|onmouseover|onmouseout|onstartup|number|main|scrollHorizontal|scrollVertical|mouseover|mouseout|bind|5000|animate|duration|easing|complete|step|PlayScroller|PauseScroller|ResetScroller|RemoveScroller|infinite|pause|pointer|return|jQuery'.split('|'),0,{}));

(function(b,gb){var v="none",t="click",N="LoadedContent",d=false,x="resize.",o="y",u="auto",f=true,M="nofollow",q="on",n="x";function e(a,c){a=a?' id="'+k+a+'"':"";c=c?' style="'+c+'"':"";return b("<div"+a+c+"/>")}function p(a,b){b=b===n?m.width():m.height();return typeof a==="string"?Math.round(a.match(/%/)?b/100*parseInt(a,10):parseInt(a,10)):a}function Q(c){c=b.isFunction(c)?c.call(h):c;return a.photo||c.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function cb(){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!==q)a[c]=a[c].call(h);a.rel=a.rel||h.rel||M;a.href=a.href||b(h).attr("href");a.title=a.title||h.title}function db(d){h=d;a=b.extend({},b(h).data(r));cb();if(a.rel!==M){i=b("."+H).filter(function(){return (b(this).data(r).rel||this.rel)===a.rel});g=i.index(h);if(g===-1){i=i.add(h);g=i.length-1}}else{i=b(h);g=0}if(!w){w=F=f;R=h;try{R.blur()}catch(e){}b.event.trigger(hb);a.onOpen&&a.onOpen.call(h);y.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":u}).show();a.w=p(a.initialWidth,n);a.h=p(a.initialHeight,o);c.position(0);S&&m.bind(x+O+" scroll."+O,function(){y.css({width:m.width(),height:m.height(),top:m.scrollTop(),left:m.scrollLeft()})}).trigger("scroll."+O)}T.add(I).add(J).add(z).add(U).hide();V.html(a.close).show();c.slideshow();c.load()}var eb={transition:"elastic",speed:300,width:d,initialWidth:"600",innerWidth:d,maxWidth:d,height:d,initialHeight:"450",innerHeight:d,maxHeight:d,scalePhotos:f,scrolling:f,inline:d,html:d,iframe:d,photo:d,href:d,title:d,rel:d,opacity:.9,preloading:f,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:d,loop:f,slideshow:d,slideshowAuto:f,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:d,onLoad:d,onComplete:d,onCleanup:d,onClosed:d,overlayClose:f,escKey:f,arrowKey:f},r="colorbox",k="cbox",hb=k+"_open",P=k+"_load",W=k+"_complete",X=k+"_cleanup",fb=k+"_closed",G=b.browser.msie&&!b.support.opacity,S=G&&b.browser.version<7,O=k+"_IE6",y,j,E,s,Y,Z,ab,bb,i,m,l,K,L,U,T,z,J,I,V,C,D,A,B,h,R,g,a,w,F,c,H=k+"Element";c=b.fn[r]=b[r]=function(c,d){var a=this;if(!a[0]&&a.selector)return a;c=c||{};if(d)c.onComplete=d;if(!a[0]||a.selector===undefined){a=b("<a/>");c.open=f}a.each(function(){b(this).data(r,b.extend({},b(this).data(r)||eb,c)).addClass(H)});c.open&&db(a[0]);return a};c.init=function(){var h="hover";m=b(gb);j=e().attr({id:r,"class":G?k+"IE":""});y=e("Overlay",S?"position:absolute":"").hide();E=e("Wrapper");s=e("Content").append(l=e(N,"width:0; height:0"),L=e("LoadingOverlay").add(e("LoadingGraphic")),U=e("Title"),T=e("Current"),J=e("Next"),I=e("Previous"),z=e("Slideshow"),V=e("Close"));E.append(e().append(e("TopLeft"),Y=e("TopCenter"),e("TopRight")),e().append(Z=e("MiddleLeft"),s,ab=e("MiddleRight")),e().append(e("BottomLeft"),bb=e("BottomCenter"),e("BottomRight"))).children().children().css({"float":"left"});K=e(d,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(y,j.append(E,K));s.children().hover(function(){b(this).addClass(h)},function(){b(this).removeClass(h)}).addClass(h);C=Y.height()+bb.height()+s.outerHeight(f)-s.height();D=Z.width()+ab.width()+s.outerWidth(f)-s.width();A=l.outerHeight(f);B=l.outerWidth(f);j.css({"padding-bottom":C,"padding-right":D}).hide();J.click(c.next);I.click(c.prev);V.click(c.close);s.children().removeClass(h);b("."+H).live(t,function(a){if(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)return f;else{db(this);return d}});y.click(function(){a.overlayClose&&c.close()});b(document).bind("keydown",function(b){if(w&&a.escKey&&b.keyCode===27){b.preventDefault();c.close()}if(w&&a.arrowKey&&!F&&i[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();I.click()}else if(b.keyCode===39&&(g<i.length-1||a.loop)){b.preventDefault();J.click()}})};c.remove=function(){j.add(y).remove();b("."+H).die(t).removeData(r).removeClass(H)};c.position=function(f,b){function c(a){Y[0].style.width=bb[0].style.width=s[0].style.width=a.style.width;L[0].style.height=L[1].style.height=s[0].style.height=Z[0].style.height=ab[0].style.height=a.style.height}var e,h=Math.max(m.height()-a.h-A-C,0)/2+m.scrollTop(),g=Math.max(m.width()-a.w-B-D,0)/2+m.scrollLeft();e=j.width()===a.w+B&&j.height()===a.h+A?0:f;E[0].style.width=E[0].style.height="9999px";j.dequeue().animate({width:a.w+B,height:a.h+A,top:h,left:g},{duration:e,complete:function(){c(this);F=d;E[0].style.width=a.w+B+D+"px";E[0].style.height=a.h+A+C+"px";b&&b()},step:function(){c(this)}})};c.resize=function(b){if(w){b=b||{};if(b.width)a.w=p(b.width,n)-B-D;if(b.innerWidth)a.w=p(b.innerWidth,n);l.css({width:a.w});if(b.height)a.h=p(b.height,o)-A-C;if(b.innerHeight)a.h=p(b.innerHeight,o);if(!b.innerHeight&&!b.height){b=l.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}l.css({height:a.h});c.position(a.transition===v?0:a.speed)}};c.prep=function(o){var d="hidden";function n(t){var o,q,s,n,d=i.length,e=a.loop;c.position(t,function(){function t(){G&&j[0].style.removeAttribute("filter")}if(w){G&&p&&l.fadeIn(100);a.iframe&&b("<iframe frameborder=0"+(a.scrolling?"":" scrolling='no'")+(G?" allowtransparency='true'":"")+"/>").attr({src:a.href,name:(new Date).getTime()}).appendTo(l);l.show();U.show().html(a.title);if(d>1){T.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,d)).show();J[e||g<d-1?"show":"hide"]().html(a.next);I[e||g?"show":"hide"]().html(a.previous);o=g?i[g-1]:i[d-1];s=g<d-1?i[g+1]:i[0];if(a.slideshow){z.show();g===d-1&&!e&&j.is("."+k+"Slideshow_on")&&z.click()}if(a.preloading){n=b(s).data(r).href||s.href;q=b(o).data(r).href||o.href;if(Q(n))b("<img/>")[0].src=n;if(Q(q))b("<img/>")[0].src=q}}L.hide();a.transition==="fade"?j.fadeTo(f,1,function(){t()}):t();m.bind(x+k,function(){c.position(0)});b.event.trigger(W);a.onComplete&&a.onComplete.call(h)}})}if(w){var p,f=a.transition===v?0:a.speed;m.unbind(x+k);l.remove();l=e(N).html(o);l.hide().appendTo(K.show()).css({width:function(){a.w=a.w||l.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?u:d}).css({height:function(){a.h=a.h||l.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);K.hide();b("#"+k+"Photo").css({cssFloat:v});S&&b("select").not(j.find("select")).filter(function(){return this.style.visibility!==d}).css({visibility:d}).one(X,function(){this.style.visibility="inherit"});a.transition==="fade"?j.fadeTo(f,0,function(){n(0)}):n(f)}};c.load=function(){var j,d,q,m=c.prep;F=f;h=i[g];a=b.extend({},b(h).data(r));cb();b.event.trigger(P);a.onLoad&&a.onLoad.call(h);a.h=a.height?p(a.height,o)-A-C:a.innerHeight&&p(a.innerHeight,o);a.w=a.width?p(a.width,n)-B-D:a.innerWidth&&p(a.innerWidth,n);a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,n)-B-D;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,o)-A-C;a.mh=a.h&&a.h<a.mh?a.h:a.mh}j=a.href;L.show();if(a.inline){e("InlineTemp").hide().insertBefore(b(j)[0]).bind(P+" "+X,function(){b(this).replaceWith(l.children())});m(b(j))}else if(a.iframe)m(" ");else if(a.html)m(a.html);else if(Q(j)){d=new Image;d.onload=function(){var e;d.onload=null;d.id=k+"Photo";b(d).css({margin:u,border:v,display:"block",cssFloat:"left"});if(a.scalePhotos){q=function(){d.height-=d.height*e;d.width-=d.width*e};if(a.mw&&d.width>a.mw){e=(d.width-a.mw)/d.width;q()}if(a.mh&&d.height>a.mh){e=(d.height-a.mh)/d.height;q()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";setTimeout(function(){m(d)},1);i[1]&&(g<i.length-1||a.loop)&&b(d).css({cursor:"pointer"}).click(c.next);if(G)d.style.msInterpolationMode="bicubic"};d.src=j}else e().appendTo(K).load(j,function(c,a,b){m(a==="error"?"Request unsuccessful: "+b.statusText:this)})};c.next=function(){if(!F){g=g<i.length-1?g+1:0;c.load()}};c.prev=function(){if(!F){g=g?g-1:i.length-1;c.load()}};c.slideshow=function(){function f(){z.text(a.slideshowStop).bind(W,function(){d=setTimeout(c.next,a.slideshowSpeed)}).bind(P,function(){clearTimeout(d)}).one(t,function(){e()});j.removeClass(b+"off").addClass(b+q)}var e,d,b=k+"Slideshow_";z.bind(fb,function(){z.unbind();clearTimeout(d);j.removeClass(b+"off "+b+q)});e=function(){clearTimeout(d);z.text(a.slideshowStart).unbind(W+" "+P).one(t,function(){f();d=setTimeout(c.next,a.slideshowSpeed)});j.removeClass(b+q).addClass(b+"off")};if(a.slideshow&&i[1])a.slideshowAuto?f():e()};c.close=function(){if(w){w=d;b.event.trigger(X);a.onCleanup&&a.onCleanup.call(h);m.unbind("."+k+" ."+O);y.fadeTo("fast",0);j.stop().fadeTo("fast",0,function(){j.find("iframe").attr("src","about:blank");l.remove();j.add(y).css({opacity:1,cursor:u}).hide();try{R.focus()}catch(c){}setTimeout(function(){b.event.trigger(fb);a.onClosed&&a.onClosed.call(h)},1)})}};c.element=function(){return b(h)};c.settings=eb;b(c.init)})(jQuery,this);



$(document).ready(function() {
	var contentResize = function(){
		if($(window).width() < 1000){
			$(".bottom_bg, .line").addClass("customWidth");
		}else{
			$(".bottom_bg, .line").removeClass("customWidth");
		}	
	}
	contentResize();
	$(window).resize(
		function(){
			contentResize();
		}
	);
	$("hr").before('<div class="clear"></div><div class="content_line"></div>').remove();				   
	//$("a[rel='gallery']").colorbox({transition:"fade"});
	$("li.page-item-522 a").attr("target","_blank").attr("href","/wp-content/uploads/2010/12/LiposuctionConsent.pdf");
	$("a[rel='gallery']").click(
		function(){
			return false;	
		}
	);
	
	$(".img_ph").dynamicRotator({width:145, height:176, interval:5000,
			callBack : function(obj){
				$(".realImg").css("background", obj.css("background"));
			}
		}
	);
	
	$('.horizontal_scroller').SetScroller({	velocity: 	 60,
		direction: 	 'horizontal',
		startfrom: 	 'right',
		loop:		 'infinite',
		movetype: 	 'linear',
		onmouseover: 'pause',
		onmouseout:  'play',
		onstartup: 	 'play',
		cursor: 	 'pointer'
	});

	
	$(".enlarge").colorbox({inline:true, href:"#imgPlaceHolder"});
	
	$("a.phone").colorbox({width:"400px", initialWidth:"300px", inline:true, href:"#click_to_call"});
	
	$(".img_list_ph").hover(
		function(){
			$(".photo_list_bg", $(this)).animate({"marginTop" : "171px", "height" : "5px"}, 100);
												 												 
		},
		function(){
			$(".photo_list_bg", $(this)).animate({"marginTop" : "102px", "height" : "72px"}, 100);
		}
	);
	
	$(".stxt").click(
		function(){
			var handler = $(this);
			if(handler.hasClass("hide")){
				$(".contact_floating").fadeOut("slow",
					function(){
						$(".contact_bg").animate({"marginTop": "0"}, 500,
							function(){
								handler.removeClass("hide");
								handler.html("Show");
								$(this).css("position","inherit");
							}
						);			
					}
				);
				
			}else{
				$(".contact_bg").css("position","absolute");
				$(".contact_bg").animate({"marginTop": "-359px"}, 500,
					function(){
						$(".contact_floating").fadeIn("fast",
							function(){
								handler.addClass("hide");	
								handler.html("Hide");
							}
						);
					}
				);
			}
		}
	)
	
	$("ul.slidermenu li a").click(
		function(){
			$("ul.slidermenu li a.current").removeClass("current");
			$(this).addClass("current");
			var indx = $(this).parent().index();
			indx = (indx == 0) ? 0 : ((indx * 270) * (-1));
			$(".slider").animate({"marginTop" : indx + "px"}, 300);
			return false;
		}
	);
	
	$("a.s_arrow_l").click(
		function(){
			var current = $("ul.slidermenu li a.current");	
			var parent = current.parent();
			var _prev = parent.prev()
			if(_prev.is("li")){
				current.removeClass("current");
				$("a", _prev).addClass("current");
				var indx = _prev.index();
				indx = (indx == 0) ? 0 : ((indx * 270) * (-1));
				$(".slider").animate({"marginTop" : indx + "px"}, 300);
				return false;
			}else{
				current.removeClass("current");
				_prev = $("ul.slidermenu li:last");
				$("ul.slidermenu li:last a").addClass("current");
				var indx = _prev.index();
				indx = (indx == 0) ? 0 : ((indx * 270) * (-1));
				$(".slider").animate({"marginTop" : indx + "px"}, 300);
				return false;		
			}
		}
	);
	
	$("a.s_arrow_r").click(
		function(){
			var current = $("ul.slidermenu li a.current");	
			var parent = current.parent();
			var _next = parent.next()
			if(_next.is("li")){
				current.removeClass("current");
				$("a", _next).addClass("current");
				var indx = _next.index();
				indx = (indx == 0) ? 0 : ((indx * 270) * (-1));
				$(".slider").animate({"marginTop" : indx + "px"}, 300);
				return false;
			}else{
				current.removeClass("current");
				_next = $("ul.slidermenu li:first");
				$("ul.slidermenu li:first a").addClass("current");
				var indx = _next.index();
				indx = (indx == 0) ? 0 : ((indx * 270) * (-1));
				$(".slider").animate({"marginTop" : indx + "px"}, 300);
				return false;		
			}
		}
	);
	
	$(".btn_next").click(
		function(){
			var _slider = $(".list_wrapper ul:first");
			var mTop = (parseInt(_slider.css("marginTop")) - 167) + _slider.height();
			if(mTop > 0){
				var s_width = _slider.outerWidth();
				_slider.animate({"marginTop": "-=167px"}, 400);
			}
			return false;
		}
	);
	$(".btn_prev").click(
		function(){
			var _slider = $(".list_wrapper ul:first");
			if(parseInt(_slider.css("marginTop")) < 0){
				_slider.animate({"marginTop": "+=167px"}, 400);
			}
			return false;
		}
	);
	
	$("#news_content").tweet({
		join_text: "auto",
		username: "kleinlipo",
		count: 10,
		auto_join_text_default: "",
		date_format: "M j, Y", 
		loading_text: "loading Latest News..."
	  });
	
	$("a.arrow_down").click(
		function(){
			var current = $(".tweet_list li:visible:first");
			var next = current.next();
			if(next.is("li")){
				$(".scrollingtext:first").html(next.html());	
				current.fadeOut("hide");
				next.fadeIn("fast");
			}else{
				$(".scrollingtext:first").html($(".tweet_list li:first").html());	
				current.fadeOut("fast");
				$(".tweet_list li:first").fadeIn("fast");
			}
			return false;
		}
	  );
	 
	 
	 if($("#form_3aacwh div.error").length > 0){
		$("#form_3aacwh div.error").prepend("<a class='closeMsg'>CLOSE MESSAGE</a>");
		$("#form_3aacwh div.error a.closeMsg").click(
			function(){
				$("#form_3aacwh div.error").hide("fast");	
			}
		);
		var wh = ($(document).height() - 400) * (-1);
		var handler = $(".stxt");
		$(".contact_bg").css("position","absolute");
		$(".contact_bg").animate({"marginTop": wh + "px"}, 500,
			function(){
				$(".contact_floating").fadeIn("fast",
					function(){
						handler.addClass("hide");	
						handler.html("Hide");
					}
				);
			}
		);
	 }
	 if($("#form_olpjg3 div.error").length > 0){
		$("a.phone").click();			 
	 }
	 
	 $("form").submit(
		function(){
			var canSubmit = true;
			$("input, textarea", this).each(
				function(index,item){
					if($(this).parent().hasClass("form-required")){
						if(($(this).val() == "") || ($(this).val() == $(this).attr("title"))){
							alert("Please fill up [" +  $(this).attr("title") + "] field");	
							$(this).val("");
							$(this).focus();
							canSubmit = false;
							return false;
						}	
					}
					if($(item).attr("title") == "Email Address:" || $(item).attr("title") == "Email"){
						if(!echeck($(item).val())){
							$(item).val("");
							$(item).focus();
							canSubmit = false;
							return false;	
						}
					}
				}
			);
			return canSubmit;
		}
	);
	 
	 var echeck = function(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
			alert("Invalid E-mail ID")
			return false
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			alert("Invalid E-mail ID")
			return false
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			alert("Invalid E-mail ID")
			return false
		}
		if (str.indexOf(at,(lat+1))!=-1){
			alert("Invalid E-mail ID")
			return false
		}
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			alert("Invalid E-mail ID")
			return false
		}
		if (str.indexOf(dot,(lat+2))==-1){
			alert("Invalid E-mail ID")
			return false
		}
		if (str.indexOf(" ")!=-1){
			alert("Invalid E-mail ID")
			return false
		}
		return true					
	}
});
