/* Main site functions. Date: Wed Aug 31 10:02 PM EST 2011 */
function ext_nwindow(){$("a[href*='http://']:not([href*='"+location.hostname+"'])").attr("target","_blank")}function sub_menus(){$("ul.sublinks").parent().find("a").addClass("submenu");$("a.submenu").hover(function(){$(this).parent().find("ul.sublinks").addClass("subhover").show("slow");$(this).parent().hover(function(){},function(){$(this).parent().find("ul.sublinks").hide("slow").removeClass("subhover")})})}$("span.replaceAt").replaceWith("@");$(ext_nwindow);$(sub_menus);function home_slides(){$("#slides").cycle({fx:"fade",speed:"slow",timeout:1E4,pager:"#pager",pagerAnchorBuilder:function(a,c){return'<a href="#">'+$(c).attr("alt")+"</a>"}})}function get_jposts(){$("#jupdates").html("Loading...");$.ajax({type:"GET",url:"http://www.vintechnology.com/journal/feed/",contentType:"text/xml; charset=utf-8",dataType:"xml",success:function(a){$("#jupdates").hide().empty().fadeIn("slow").removeAttr("filter");$(a).find("item:lt(3)").each(function(){var a=$(this).find("title").text(),b=$(this).find("link").text();$(this).find("dc:creator").text();$(this).find("pubDate").text();var e=$(this).find("description").text(),a='<div class="jpost"><a href="'+b+'" class="jtitle">'+a+"</a>";a+="<br /><br />"+e+"";a+="</div>";$("#jupdates").append(a)})}})}function load_tweets(){function a(a){var a=a.replace(/(\+[0-9]{4}\s)/ig,""),b=Date.parse(a),b=parseInt(((arguments.length>1?arguments[1]:new Date).getTime()-b)/1E3);return b<60?"less than a minute ago":b<120?"about a minute ago":b<2700?parseInt(b/60).toString()+" minutes ago":b<5400?"about an hour ago":b<86400?"about "+parseInt(b/3600).toString()+" hours ago":b<172800?"1 day ago":parseInt(b/86400).toString()+" days ago"}$.getJSON("http://twitter.com/statuses/user_timeline.json?screen_name=VINTECHSYSTEMS&count=10&callback=?",function(c){var b=$("#tweets");$.each(c,function(c,d){b.append('<div class="tweet">&ldquo;'+d.text.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,"<a href='$1'>$1</a>")+"&rdquo;&ndash; "+a(d.created_at)+"</div>")})})}function get_social(){$("#scontent").empty().html("<p>Loading...</p>");var a=$(this).attr("id");$.get("/ajx/gsocial.php",{sn:a,lang:"en"},function(c){$("#scontent").empty().html(c);a=="tw"?load_tweets():a=="sclose"&&(get_jposts(),nl_toggle(),nl_val());ext_nwindow()});return!1}$("a.sajx").click(get_social);var jqmap="js/jquery.gomap.js";function gmap_options(){$("#map").goMap({markers:[{latitude:map_lat,longitude:map_long,html:{content:map_content,popup:!1}}],mapTypeControl:!0,mapTypeControlOptions:{position:"TOP_RIGHT",style:"DROPDOWN_MENU"},scaleControl:!0,maptype:"ROADMAP",zoom:12})}function load_gmap(){$.ajax({type:"GET",url:jqmap,cache:!0,dataType:"script",success:function(){setTimeout(gmap_options,1E3)}})}function cont_sub(){$("#cont_results").html('<img src="/images/ajxload_sm.gif" />');$.post("/ajx/cform.php",$("form").serialize(),function(a){a.success=="yes"?($("#cont_right").empty(),$("#cont_right").html(a.message).addClass("ok")):a.success=="no"&&$("#cont_results").html(a.message).addClass("required")},"json");return!1}function cont_check(){$("#cont_agree").click(function(){$("#csubmit").toggle();$("#cont_agree").is(":checked")?($("#contact").attr("method","post"),$("#csubmit").removeAttr("disabled"),$("#cont_results").show(),$("#cont_forms").undelegate("#csubmit","click",cont_sub),$("#cont_forms").delegate("#csubmit","click",cont_sub)):($("#contact").removeAttr("method"),$("#csubmit").attr("disabled","disabled"),$("#cont_results").hide().empty(),$("#cont_forms").undelegate("#csubmit","click",cont_sub))})};function get_cstudy(){$("#cltest").empty().show("slow").html("<p>Loading...</p>");var a=$(this).attr("id"),a=$.get("/ajx/gcstudy.php",{cs:a,lang:"en"},function(a){$("#cltest").empty().html(a)});a.success(function(){$("html,body").delay(100).animate({scrollTop:$(document).height()},500)});a.error(function(){console.log("AJAX request failed.")});return!1}function get_clist(){$("#clcontain").empty().html("<p>Loading...</p>");var a=$(this).attr("id");$.get("/ajx/gclist.php",{sn:a,lang:"en"},function(a){$("#clcontain").empty().html(a);ext_nwindow();$("#clcontain").undelegate("a.cstudy","click",get_cstudy);$("#clcontain").delegate("a.cstudy","click",get_cstudy)});return!1}$("a.cstudy").click(get_cstudy);$("a.vcajx").click(get_clist);function ca_sub(){$("#caform").attr({action:"ajx/caform.php",target:"ca_results"});$("#caform").validate({rules:{ca_fname:{required:!0},ca_lname:{required:!0},ca_type:{required:!0},ca_resume:{required:!0,accept:"doc|DOC|docx|DOCX|odt|ODT|pdf|PDF|rtf|RTF|sxw|SXW|txt|TXT|wp|WP|wpd|WPD|wps|WPS"},ca_int:{required:!0},ca_agree:{required:!0,number:!0}},submitHandler:function(a){$("#ca_results").show();a.submit();setTimeout(function(){var a=$("#ca_results").contents().find("span.ustatus").html();a==1?$("#caright").empty().addClass("ok").html('<p>Thank you for submitting your resume. If you are a match, we will contact you soon.</p><a href="/">Return</a>'):console.log("The value of ustatus is "+a+" so it did not work!")},5E3)}})}function ca_check(){$("#ca_agree").click(function(){$("#casubmit").toggle();$("#ca_agree").is(":checked")?($("#caform").attr("method","post"),$("#casubmit").removeAttr("disabled"),$("#ca_results").show(),$("#caright").undelegate("#casubmit","click",ca_sub),$("#caright").delegate("#casubmit","click",ca_sub)):($("#caform").removeAttr("method"),$("#casubmit").attr("disabled","disabled"),$("#ca_results").hide().empty(),$("#caright").undelegate("#casubmit","click",ca_sub))})};function nl_toggle(){$("#nltoggle").click(function(){$("#newsletter").toggle();return!1})}function nl_val(){$("#nletter").attr({action:"http://oi.vresp.com?fid=756f266bf0",target:"nlresults"});$("#nletter").validate({rules:{email_address:{required:!0,email:!0},first_name:{required:!0},last_name:{required:!0}},submitHandler:function(a){$("#nlresults").show();a.submit()}})};

