$(document).ready(function(){$("#sidebar").find("h2:first").addClass("first");$('.swap').live('mouseover mouseout',function(event){if(event.type=='mouseover'){if($(this).attr("src").indexOf("-on.")==-1){var newSrc=$(this).attr("src");newSrc=(newSrc.replace(/.jpg|.gif|.png/,'-on'+newSrc.substr(newSrc.length-4)));$(this).attr("src",newSrc);}}else{if($(this).attr("src").indexOf("-on.")>0){var oldSrc=$(this).attr("src").replace('-on.','.');$(this).attr("src",oldSrc);}}});$('#content div.inner-content .post:last').addClass('no-border');$('#content div.blog-listing .post:last').addClass('no-border');$('.commentlist li:last').addClass('last');$('ul.search-results li:last').addClass("last");$("#profession_other").click(function(){if($(this).attr("checked")==true){$("#profession_extra").show();}else{$("#profession_extra").hide();}});$("input.profession-developer").click(function(){if($(this).attr("checked")==true){$("#developerPlatformMobile").show();$("#developerPlatformOnline").show();}else{$("#developerPlatformMobile").hide();$("#developerPlatformOnline").hide();}});$("#mobilePlatform_other").click(function(){if($(this).attr("checked")==true){$("#mobilePlatform_extra").show();}else{$("#mobilePlatform_extra").hide();}});$("#onlinePlatform_other").click(function(){if($(this).attr("checked")==true){$("#onlinePlatform_extra").show();}else{$("#onlinePlatform_extra").hide();}});$("#technicalSkills_other").click(function(){if($(this).attr("checked")==true){$("#technicalSkills_extra").show();}else{$("#technicalSkills_extra").hide();}});$("#supportmena_other").click(function(){if($(this).attr("checked")==true){$("#supportmena_extra").show();}else{$("#supportmena_extra").hide();}});$("#revenue_other").click(function(){if($(this).attr("checked")==true){$("#revenue_extra").show();}else{$("#revenue_extra").hide();}});$("input[name='platform']").change(function(){if($(this).val()!='other'){$("#platform_extra").hide();}});$("#platform_other").click(function(){if($(this).attr("checked")==true){$("#platform_extra").show();}else{$("#platform_extra").hide();}});$("#technicalSkills_none").click(function(){if($(this).attr("checked")==true){$(".technicalSkills").each(function(){$(this).attr("disabled",true);});}else{$(".technicalSkills").each(function(){$(this).attr("disabled",false);});}});if($("#technicalSkills_none").attr("checked")==true){$('#technicalSkills_none').trigger('click');$("#technicalSkills_none").attr("checked",true);}
$("input[name='menaRegion']").click(function(){if($(this).val()=='yes'){$("form.investment-form").show();$("#notMenaRegion").hide();$("#isMenaRegion").val('yes');}else{$("form.investment-form").hide();$("#notMenaRegion").show();$("#isMenaRegion").val('no');}});$("#contentLang_other").click(function(){if($(this).attr("checked")==true){$("#contentLang_extra").show();}else{$("#contentLang_extra").hide();}});$("input[name='downloadPrice']").click(function(){if($(this).val()=='other'){$("#downloadPrice_extra").show();}else{$("#downloadPrice_extra").hide();}});$("input[name='measureDemand']").click(function(){if($(this).val()=='yes'){$("#measureDemandReason").show();}else{$("#measureDemandReason").hide();}});$("textarea.max-500, textarea.max-2000").keypress(function(event){var key=event.which;var maxLength=540;if($(this).hasClass('max-2000')){maxLength=2050;}
if(key>=33||key==13){var length=this.value.length;if(length>=maxLength){event.preventDefault();}}});});function addResponse(htmlId,errorMessage){$('#'+htmlId).addClass('error');$('#'+htmlId).html(errorMessage);}
function isCheckedById(id){var checked=$("input[@id="+id+"]:checked").length;if(checked==0){return false;}else{return true;}}
function isCheckedByName(name){var isChecked=false;$("input[name="+name+"]").each(function(){if(this.checked){isChecked=true;}});return isChecked;}
function isNotNullById(id){var val=$("input[type=text][@id="+id+"]").val();if(val==''){return false;}else{return true;}}
function isNotNullByName(name){var val=$("input[name="+name+"]").val();if(val==''){return false;}else{return true;}}
function allowPhone(e){if(e.charCode==0)return true;var unicode=e.charCode?e.charCode:e.keyCode;if(unicode==13)return true;if(unicode>47&&unicode<58)
return true;else if(unicode==40||unicode==41||unicode==43||unicode==32)
return true;else return false;}
function allowAlphanumeric(e){if(e.charCode==0)return true;var unicode=e.charCode?e.charCode:e.keyCode;if(unicode==13)return true;if((unicode>47&&unicode<58)||(unicode>64&&unicode<91)||(unicode>96&&unicode<123)){return true;}else{return false;}}
function isValidEmail(str){filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
return(filter.test(str));}
function toggleTextOut(e,txtval){if(e.value=="")e.value=txtval;}
function toggleTextIn(e,txtval){if(e.value==txtval)e.value="";else e.select();}
function searchboxValidate(msg,idName){sb=document.getElementById(idName).value;if(sb==msg||sb==""){document.getElementById(idName).value=msg;document.getElementById(idName).focus();return false;}
return true;}
function spamFreeEmailLink(user,domain,tag,title){if(tag){document.write('<a  target="_blank" href="'+'mailto:'+user+'@'+domain+'">'+title+'</a>');}else{document.write(user+'@'+domain);}}
function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3')?g+' ff3':is('gecko/')?g:/opera(\s|\/)(\d+)/.test(ua)?'opera opera'+RegExp.$2:is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js'];c=b.join(' ');h.className+=' '+c;return c;};css_browser_selector(navigator.userAgent);
