/* ------------------------------------------------------------------------
	Class: prettyPhoto
	Use: Lightbox clone for jQuery
	Author: Stephane Caron (http://www.no-margin-for-errors.com)
	Version: 2.5.3
------------------------------------------------------------------------- */

(function(a){a.prettyPhoto={version:"2.5.3"};a.fn.prettyPhoto=function(t){t=jQuery.extend({animationSpeed:"normal",padding:40,opacity:0.8,showTitle:true,allowresize:true,counter_separator_label:"/",theme:"dark_rounded",hideflash:false,modal:false,changepicturecallback:function(){},callback:function(){}},t);if(a.browser.msie&&a.browser.version==6){t.theme="light_square"}if(a(".pp_overlay").size()==0){u()}else{o=a(".pp_pic_holder");x=a(".ppt")}var d=true,h=false,s,o,x,t,m,n,r,v,e="image",c=0,j=f();a(window).scroll(function(){j=f();i();q()});a(window).resize(function(){i();q()});a(document).keydown(function(y){if(o.is(":visible")){switch(y.keyCode){case 37:a.prettyPhoto.changePage("previous");break;case 39:a.prettyPhoto.changePage("next");break;case 27:if(!t.modal){a.prettyPhoto.close()}break}}});a(this).each(function(){a(this).bind("click",function(){link=this;theRel=a(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var y=new Array(),A=new Array(),z=new Array();if(theGallery){a("a[rel*="+theGallery+"]").each(function(B){if(a(this)[0]===a(link)[0]){c=B}y.push(a(this).attr("href"));A.push(a(this).find("img").attr("alt"));z.push(a(this).attr("title"))})}else{y=a(this).attr("href");A=(a(this).find("img").attr("alt"))?a(this).find("img").attr("alt"):"";z=(a(this).attr("title"))?a(this).attr("title"):""}a.prettyPhoto.open(y,A,z);return false})});a.prettyPhoto.open=function(A,z,y){if(a.browser.msie&&a.browser.version==6){a("select").css("visibility","hidden")}if(t.hideflash){a("object,embed").css("visibility","hidden")}images=a.makeArray(A);titles=a.makeArray(z);descriptions=a.makeArray(y);if(a(".pp_overlay").size()==0){u()}else{o=a(".pp_pic_holder");x=a(".ppt")}o.attr("class","pp_pic_holder "+t.theme);isSet=(a(images).size()>0)?true:false;w(images[c]);i();g(a(images).size());a(".pp_loaderIcon").show();a("div.pp_overlay").show().fadeTo(t.animationSpeed,t.opacity,function(){o.fadeIn(t.animationSpeed,function(){o.find("p.currentTextHolder").text((c+1)+t.counter_separator_label+a(images).size());if(descriptions[c]){o.find(".pp_description").show().html(unescape(descriptions[c]))}else{o.find(".pp_description").hide().text("")}if(titles[c]&&t.showTitle){hasTitle=true;x.html(unescape(titles[c]))}else{hasTitle=false}if(e=="image"){imgPreloader=new Image();nextImage=new Image();if(isSet&&c>a(images).size()){nextImage.src=images[c+1]}prevImage=new Image();if(isSet&&images[c-1]){prevImage.src=images[c-1]}pp_typeMarkup='<img id="fullResImage" src="" />';o.find("#pp_full_res")[0].innerHTML=pp_typeMarkup;o.find(".pp_content").css("overflow","hidden");o.find("#fullResImage").attr("src",images[c]);imgPreloader.onload=function(){s=l(imgPreloader.width,imgPreloader.height);_showContent()};imgPreloader.src=images[c]}else{movie_width=(parseFloat(b("width",images[c])))?b("width",images[c]):"425";movie_height=(parseFloat(b("height",images[c])))?b("height",images[c]):"344";if(movie_width.indexOf("%")!=-1||movie_height.indexOf("%")!=-1){movie_height=(a(window).height()*parseFloat(movie_height)/100)-100;movie_width=(a(window).width()*parseFloat(movie_width)/100)-100;h=true}movie_height=parseFloat(movie_height);movie_width=parseFloat(movie_width);if(e=="quicktime"){movie_height+=15}s=l(movie_width,movie_height);if(e=="youtube"){pp_typeMarkup='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+s.width+'" height="'+s.height+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.youtube.com/v/'+b("v",images[c])+'" /><embed src="http://www.youtube.com/v/'+b("v",images[c])+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+s.width+'" height="'+s.height+'"></embed></object>'}else{if(e=="quicktime"){pp_typeMarkup='<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="'+s.height+'" width="'+s.width+'"><param name="src" value="'+images[c]+'"><param name="autoplay" value="true"><param name="type" value="video/quicktime"><embed src="'+images[c]+'" height="'+s.height+'" width="'+s.width+'" autoplay="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>'}else{if(e=="flash"){flash_vars=images[c];flash_vars=flash_vars.substring(images[c].indexOf("flashvars")+10,images[c].length);filename=images[c];filename=filename.substring(0,filename.indexOf("?"));pp_typeMarkup='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+s.width+'" height="'+s.height+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+filename+"?"+flash_vars+'" /><embed src="'+filename+"?"+flash_vars+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+s.width+'" height="'+s.height+'"></embed></object>'}else{if(e=="iframe"){movie_url=images[c];movie_url=movie_url.substr(0,movie_url.indexOf("iframe")-1);pp_typeMarkup='<iframe src ="'+movie_url+'" width="'+(s.width-10)+'" height="'+(s.height-10)+'" frameborder="no"></iframe>'}}}}_showContent()}})})};a.prettyPhoto.changePage=function(y){if(y=="previous"){c--;if(c<0){c=0;return}}else{if(a(".pp_arrow_next").is(".disabled")){return}c++}if(!d){d=true}k();a("a.pp_expand,a.pp_contract").fadeOut(t.animationSpeed,function(){a(this).removeClass("pp_contract").addClass("pp_expand");a.prettyPhoto.open(images,titles,descriptions)})};a.prettyPhoto.close=function(){o.find("object,embed").css("visibility","hidden");a("div.pp_pic_holder,div.ppt").fadeOut(t.animationSpeed);a("div.pp_overlay").fadeOut(t.animationSpeed,function(){a("div.pp_overlay,div.pp_pic_holder,div.ppt").remove();if(a.browser.msie&&a.browser.version==6){a("select").css("visibility","visible")}if(t.hideflash){a("object,embed").css("visibility","visible")}c=0;t.callback()});d=true};_showContent=function(){a(".pp_loaderIcon").hide();if(a.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=a(window).height();windowWidth=a(window).width()}projectedTop=j.scrollTop+((windowHeight/2)-(s.containerHeight/2));if(projectedTop<0){projectedTop=0+o.find(".ppt").height()}o.find(".pp_content").animate({height:s.contentHeight},t.animationSpeed);o.animate({top:projectedTop,left:((windowWidth/2)-(s.containerWidth/2)),width:s.containerWidth},t.animationSpeed,function(){o.width(s.containerWidth);o.find(".pp_hoverContainer,#fullResImage").height(s.height).width(s.width);o.find("#pp_full_res").fadeIn(t.animationSpeed);if(isSet&&e=="image"){o.find(".pp_hoverContainer").fadeIn(t.animationSpeed)}else{o.find(".pp_hoverContainer").hide()}o.find(".pp_details").fadeIn(t.animationSpeed);if(t.showTitle&&hasTitle){x.css({top:o.offset().top-20,left:o.offset().left+(t.padding/2),display:"none"});x.fadeIn(t.animationSpeed)}if(s.resized){a("a.pp_expand,a.pp_contract").fadeIn(t.animationSpeed)}if(e!="image"){o.find("#pp_full_res")[0].innerHTML=pp_typeMarkup}t.changepicturecallback()})};function k(){o.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");o.find(".pp_hoverContainer,.pp_details").fadeOut(t.animationSpeed);o.find("#pp_full_res").fadeOut(t.animationSpeed,function(){a(".pp_loaderIcon").show()});x.fadeOut(t.animationSpeed)}function g(y){if(c==y-1){o.find("a.pp_next").css("visibility","hidden");o.find("a.pp_arrow_next").addClass("disabled").unbind("click")}else{o.find("a.pp_next").css("visibility","visible");o.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click",function(){a.prettyPhoto.changePage("next");return false})}if(c==0){o.find("a.pp_previous").css("visibility","hidden");o.find("a.pp_arrow_previous").addClass("disabled").unbind("click")}else{o.find("a.pp_previous").css("visibility","visible");o.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click",function(){a.prettyPhoto.changePage("previous");return false})}if(y>1){a(".pp_nav").show()}else{a(".pp_nav").hide()}}function l(z,y){hasBeenResized=false;p(z,y);imageWidth=z;imageHeight=y;windowHeight=a(window).height();windowWidth=a(window).width();if(((v>windowWidth)||(r>windowHeight))&&d&&t.allowresize&&!h){hasBeenResized=true;notFitting=true;while(notFitting){if((v>windowWidth)){imageWidth=(windowWidth-200);imageHeight=(y/z)*imageWidth}else{if((r>windowHeight)){imageHeight=(windowHeight-200);imageWidth=(z/y)*imageHeight}else{notFitting=false}}r=imageHeight;v=imageWidth}p(imageWidth,imageHeight)}return{width:imageWidth,height:imageHeight,containerHeight:r,containerWidth:v,contentHeight:m,contentWidth:n,resized:hasBeenResized}}function p(z,y){o.find(".pp_details").width(z).find(".pp_description").width(z-parseFloat(o.find("a.pp_close").css("width")));m=y+o.find(".pp_details").height()+parseFloat(o.find(".pp_details").css("marginTop"))+parseFloat(o.find(".pp_details").css("marginBottom"));n=z;r=m+o.find(".ppt").height()+o.find(".pp_top").height()+o.find(".pp_bottom").height();v=z+t.padding}function w(y){if(y.match(/youtube\.com\/watch/i)){e="youtube"}else{if(y.indexOf(".mov")!=-1){e="quicktime"}else{if(y.indexOf(".swf")!=-1){e="flash"}else{if(y.indexOf("iframe")!=-1){e="iframe"}else{e="image"}}}}}function i(){if(a.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=a(window).height();windowWidth=a(window).width()}if(d){$pHeight=o.height();$pWidth=o.width();$tHeight=x.height();projectedTop=(windowHeight/2)+j.scrollTop-($pHeight/2);if(projectedTop<0){projectedTop=0+$tHeight}o.css({top:projectedTop,left:(windowWidth/2)+j.scrollLeft-($pWidth/2)});x.css({top:projectedTop-$tHeight,left:(windowWidth/2)+j.scrollLeft-($pWidth/2)+(t.padding/2)})}}function f(){if(self.pageYOffset){scrollTop=self.pageYOffset;scrollLeft=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){scrollTop=document.documentElement.scrollTop;scrollLeft=document.documentElement.scrollLeft}else{if(document.body){scrollTop=document.body.scrollTop;scrollLeft=document.body.scrollLeft}}}return{scrollTop:scrollTop,scrollLeft:scrollLeft}}function q(){a("div.pp_overlay").css({height:a(document).height(),width:a(window).width()})}function u(){toInject="";toInject+="<div class='pp_overlay'></div>";toInject+='<div class="pp_pic_holder"><div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div><div class="pp_content"><a href="#" class="pp_expand" title="Expand the image">Expand</a><div class="pp_loaderIcon"></div><div class="pp_hoverContainer"><a class="pp_next" href="#">next</a><a class="pp_previous" href="#">previous</a></div><div id="pp_full_res"></div><div class="pp_details clearfix"><a class="pp_close" href="#">Close</a><p class="pp_description"></p><div class="pp_nav"><a href="#" class="pp_arrow_previous">Previous</a><p class="currentTextHolder">0'+t.counter_separator_label+'0</p><a href="#" class="pp_arrow_next">Next</a></div></div></div><div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div></div>';toInject+='<div class="ppt"></div>';a("body").append(toInject);a("div.pp_overlay").css("opacity",0);o=a(".pp_pic_holder");x=a(".ppt");a("div.pp_overlay").css("height",a(document).height()).hide().bind("click",function(){if(!t.modal){a.prettyPhoto.close()}});a("a.pp_close").bind("click",function(){a.prettyPhoto.close();return false});a("a.pp_expand").bind("click",function(){$this=a(this);if($this.hasClass("pp_expand")){$this.removeClass("pp_expand").addClass("pp_contract");d=false}else{$this.removeClass("pp_contract").addClass("pp_expand");d=true}k();o.find(".pp_hoverContainer, .pp_details").fadeOut(t.animationSpeed);o.find("#pp_full_res").fadeOut(t.animationSpeed,function(){a.prettyPhoto.open(images,titles,descriptions)});return false});o.find(".pp_previous, .pp_arrow_previous").bind("click",function(){a.prettyPhoto.changePage("previous");return false});o.find(".pp_next, .pp_arrow_next").bind("click",function(){a.prettyPhoto.changePage("next");return false});o.find(".pp_hoverContainer").css({"margin-left":t.padding/2})}};function b(e,d){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var c="[\\?&]"+e+"=([^&#]*)";var g=new RegExp(c);var f=g.exec(d);if(f==null){return""}else{return f[1]}}})(jQuery);

/*
 * jQuery Form Example Plugin 1.4.2
 * Populate form inputs with example text that disappears on focus.
 *
 * Copyright (c) Paul Mucur (http://mucur.name), 2007-2008.
 * Dual-licensed under the BSD (BSD-LICENSE.txt) and GPL (GPL-LICENSE.txt)
 * licenses.
 */
(function(a){a.fn.example=function(e,c){var d=a.isFunction(e);var b=a.extend({},c,{example:e});return this.each(function(){var f=a(this);if(a.metadata){var g=a.extend({},a.fn.example.defaults,f.metadata(),b)}else{var g=a.extend({},a.fn.example.defaults,b)}if(!a.fn.example.boundClassNames[g.className]){a(window).unload(function(){a("."+g.className).val("")});a("form").submit(function(){a(this).find("."+g.className).val("")});a.fn.example.boundClassNames[g.className]=true}if(a.browser.msie&&!f.attr("defaultValue")&&(d||f.val()==g.example)){f.val("")}if(f.val()==""&&this!=document.activeElement){f.addClass(g.className);f.val(d?g.example.call(this):g.example)}f.focus(function(){if(a(this).is("."+g.className)){a(this).val("");a(this).removeClass(g.className)}});f.change(function(){if(a(this).is("."+g.className)){a(this).removeClass(g.className)}});f.blur(function(){if(a(this).val()==""){a(this).addClass(g.className);a(this).val(d?g.example.call(this):g.example)}})})};a.fn.example.defaults={className:"example"};a.fn.example.boundClassNames=[]})(jQuery);


// When document is ready
$(function(){
	/* Start the code for Fancy Scrolling*/
	function filterPath(string){return string.replace(/^\//,'').replace(/(index|default).[a-zA-Z]{3,4}$/,'').replace(/\/$/,'')}var locationPath=filterPath(location.pathname);$('a[href*=#]').each(function(){var thisPath=filterPath(this.pathname)||locationPath;if(locationPath==thisPath&&(location.hostname==this.hostname||!this.hostname)&&this.hash.replace(/#/,'')){var $target=$(this.hash),target=this.hash;if(target){var targetOffset=$target.offset().top;$(this).click(function(event){event.preventDefault();$('html, body').animate({scrollTop:targetOffset},400,function(){location.hash=target})})}}});
	/* End the code for Fancy Scrolling */
	
	$("a[rel^='pG']").prettyPhoto();
	
	$('.nlink ul li a').hover(function(){$(this).stop().animate({'paddingLeft':'10px'},150)},function(){$(this).stop().animate({'paddingLeft':'5px'},300)});
	
	$('input, textarea').example(function(){if($(this).attr('title') != "") return $(this).attr('title');},{className:'eg_text'});
	
	$('input#q').focus(function(){$(this).parent().css('background-position','0 bottom');});
	$('input#q').blur(function(){$(this).parent().css('background-position','0 0')});

	$('a#recaptcha').bind('click', sendCaptcha);
	if(jQuery.browser.msie && parseInt(jQuery.browser.version) <= 6){
		var content = '<div id="ffdownload"><a id="ffdl" href="http://www.mozilla.com/en-US/?from=sfx&amp;uid=275157&amp;t=456">Download Firefox - Free</a><div id="ffwar"><span>WARNING - Incompatible browser detected</span>We have detected that you are using an old and an unsafe browser IE v'+jQuery.browser.version+' which cannot render this website correctly. To view this website to its full potential please switch to a FREE and a secure browser <a href="http://www.firefox.com/" target="_blank">Firefox</a>. To close this warning <a id="ffclose" href="#">click here</a>.</div></div>';
		$('body').find('div:first').before(content);
		$("a#ffclose").click(function(){$("div#ffdownload").fadeOut("slow")});
	}
	// Limit textarea
	$('#add, #id').bind("keyup",function(e){
		var t = new Number(500);
		var r = new Number(0);
		var v = $(this).val();
		var l = new Number(v.length);
		if(l > t){
			$(this).val(v.substr(0,t));
			return false;
		}
		else return true;
	});
	
	// When the form is submitted
	$('input#send').removeAttr('disabled');
	$('input#send').click(function(){$('#fback').submit();});
	$('#fback').submit(function(){chkForm(); return false});

});


// Send captcha request
function sendCaptcha(){
	$('a#recaptcha').unbind('click', sendCaptcha); // Prevent further clicks
	var isrc = $('img#captcha').attr('src');
	$('img#captcha').attr('src','images/captcha/noise_animated.gif');
	$.ajax({
	  type	: "GET",
	  url		: "images/captcha",
	  success	: function(){
		 var ts	= new Date().getTime();
		 $('img#captcha').attr('src',isrc+'?'+ts);
		 $('a#recaptcha').bind('click', sendCaptcha); // Rebind
	  }
	});
}

// Check Email for validity
function chkEmail(o){
	if ( !((/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i).test($(o).val())) ) return false;
	else return true;
}

// Check wheather the field is empty or not
function chkEmpty(o){
	if($.trim($(o).val()).length > 0) return true;
	else return false;
}

// Check wheather the field is empty or not if it is add class otherwise remove class
function chkField(o){
	if(!chkEmpty($(o).get())){
		$(o).addClass('fld_error');
		bug++;
		return false;
	}
	else if( $(o).attr('id') == "email" && !chkEmail($(o).get()) ){
		$(o).addClass('fld_error');
		bug++;
		return false;
	}
	else{
		$(o).removeClass('fld_error');
		return true;
	}
}

function chkForm(){
	$('input#send').attr('disabled','disabled');
	bug		= 0;
	var nf	= (chkField($('input#name').get()))?true:false;
	var ef	= (chkField($('input#email').get()))?true:false;
	var cf	= (chkField($('textarea#comment').get()))?true:false;
	var cpf	= (chkField($('input#captcha_text').get()))?true:false;
	if(nf && ef && cf && cpf){
		$.post('images/captcha/captcha_check.php',{c:$('input#captcha_text').val()},function(data){
			if(data=="1"){
				$.post('includes/send_mail.php',{name:$('input#name').val(), email:$('input#email').val(), ocup:$('input#ocup').val(), mobile:$('input#mob').val(), comment:$('textarea#comment').val()},function(data){
					if(data=="1"){
						$('form#fback').hide("slow").after('<div class="prefix_1"><strong>Feedback was successfully sent. We thank you for your feedback.</strong></div>');
						return true;
					}
					else{
						$('input#send').removeAttr('disabled');
						alert("Sorry, we were not able to send your feedback. Please try later.");
					}
				});
			}
			else{
				sendCaptcha();
				$('input#captcha_text').addClass('fld_error');
				bug++;
				$('input#send').removeAttr('disabled');
				alert("You have done "+bug+" mistake(s).\n Please correct the highlighted field(s) first!");
			}
		});
	}
	else{
		$('input#send').removeAttr('disabled');
		alert("You have done "+bug+" mistake(s).\n Please correct the highlighted field(s) first!");
	}
}