//open jquery
function showStudy(){
$("#shown-study").slideDown("fast");
}
function hideStudy(){
$("#shown-study").slideUp("fast");
}
$(function() {
// REGISTRATION FORM
if ( $('textarea.limited').length > 0 ) {
$('textarea.limited').before('
0 of 255 characters
');
// attach character limit to 'my story' registration and profile edit form fields
$('textarea.limited').maxlength({
'feedback' : '.charsLeft',
'useInput' : true
});
}
// GA TRACKING HELPERS
// external links
$("a[href^='http://'],a[href^='https://']").click(function(){
if( $(this).attr('href').indexOf("herconnection.com") > -1 ) { // check for HERconnection outgoing link
for (index in pageTrackers) {
pageTrackers[index]._trackPageview('/outgoing/herconnection/' + $(this).attr('href'));
}
} else {
for (index in pageTrackers) {
pageTrackers[index]._trackPageview('/outgoing/' + $(this).attr('href'));
}
}
});
// downloads
// track links to doc, eps, svg, xls, ppt, pdf, xls, zip, vsd, vxd, rar, exe, wma, mov, avi, wmv, mp3, mp4
$("a[href$='.doc'],a[href$='.eps'],a[href$='.svg'],a[href$='.xls'],a[href$='.ppt'],a[href$='.pdf'],a[href$='.xls'],a[href$='.zip'],a[href$='.vsd'],a[href$='.vxd'],a[href$='.rar'],a[href$='.exe'],a[href$='.wma'],a[href$='.mov'],a[href$='.avi'],a[href$='.wmv'],a[href$='.mp3'],a[href$='.mp4']").click(function(){
for (index in pageTrackers) {
pageTrackers[index]._trackPageview('/download/' + $(this).attr('href'));
}
});
$("#logo").css("outline", "none");
//share this page: open and close
$("#btn-share").click(function(){
$("#btn-share").css("outline", "none");
$("div#share-page").css("left", "547px");
$("div#share-page").css("top", "133px");
$("div#share-page").slideDown()
return false;
});
$("#close-share").click(function(){
$("div#share-page").slideUp("slow");
return false;
});
$("#btn-explanation").click(function(){
$("#btn-explanation").css("outline", "none");
$("div#explanation").css("left", "232px");
$("div#explanation").css("top", "50px");
$("div#explanation").slideDown("fast")
return false;
});
$("#close-explanation").click(function(){
$("div#explanation").slideUp("fast");
return false;
});
//share this page popup links
$("#share-content li a").click(function(){
hrefString = $(this).attr("href");
offsiteWin = window.open(hrefString,"offsiteLink",'height=450, width=800, status=no, menubar=no, resizable=yes, scrollbars=yes, toolbar=no, location=no');
offsiteWin.focus()
return false;
});
//mod tracker
//$('#mod-tracker-input').datepicker();
//quick link
$("#quicklink-link").click(function(){
$('#quicklink-progress').css("display","block");
$("#quicklink-form").submit();
return false;
});
$("#quicklink-form").submit(function() {
var inputs = [];
$(':input', this).each(function() {
inputs.push(this.name + '=' + escape(this.value));
});
var now = new Date();
inputs.push('cachekiller=' + now.valueOf());
jQuery.ajax({
data: inputs.join('&'),
url: this.action,
timeout: 10000,
error: function(req, desc, ex) {
$('#quicklink-progress').css("display","none");
$('#quicklink-notes').css("display","block");
$('#quicklink-notes-content').html("There was an error processing your request");
},
success: function(rdata, status) {
$('#quicklink-progress').css("display","none");
if(rdata == "success"){
$('#quicklink-notes').css("display","block");
$('#quicklink-notes-content').html("Quicklink successfully added.");
$('#quicklink-contained').css("display","block");
$('#quicklink-notcontained').css("display","none");
}else{
$('#quicklink-notes').css("display","block");
$('#quicklink-notes-content').html(rdata);
}
}
});
return false;
});
//share this page
$('#share-page-form').submit(function() {
$('#share-page-notes').css("display","none");
$('#share-page-progress').css("display","block");
var inputs = [];
$(':input', this).each(function() {
inputs.push(this.name + '=' + escape(this.value));
});
jQuery.ajax({
data: inputs.join('&'),
url: this.action,
timeout: 10000,
error: function(req, desc, ex) {
$('#share-page-progress').css("display","none");
$('#share-page-notes-content').css("color","red");
$('#share-page-notes-content .errors').css("border","0");
$('#share-page-notes-content .errors').css("margin","0");
$('#share-page-notes-content').text("there was an error processing your request");
$('#share-page-notes').css("display","block");
},
success: function(rdata, status) {
$('#share-page-progress').css("display","none");
if(rdata == "success"){
$('#share-page-notes-content').css("color","red");
$('#share-page-notes-content').css("width","100%");
$('#share-page-notes-content').text("Your message was sent.");
$('#share-content input#to-email').val("");
$('#share-content input#to-name').val("");
$('#share-content textarea').val("");
}else{
$('#share-page-notes-content').css("color","red");
$('#share-page-notes-content .errors').css("border","0");
$('#share-page-notes-content .errors').css("margin","0");
$('#share-page-notes-content').html(rdata);
}
$('#share-page-notes').css("overflow","hidden")
$('#share-page-notes').css("display","block");
$('#share-page-notes').css("margin-bottom","10px");
$('#share-page-notes ').css("width","180px");
$('#share-page-notes').css("position","relative");
$('#share-page-notes').css("z-index","101");
}
});
return false;
});
$("#show-study").click(function(){
showStudy();
return false;
});
$("#hide-study").click(function(){
hideStudy();
return false;
});
$('.links-list li a').tooltip({showURL: false, showBody: " - "});
$('.tool-tip').tooltip({showURL: false, showBody: " - "});
//webcast page popup links
$('a[rel="webcast"]').click(function(){
hrefString = $(this).attr("href");
offsiteWin = window.open(hrefString,"offsiteLink",'height=768, width=1024, status=yes, menubar=no, resizable=yes, scrollbars=yes, toolbar=no, location=yes');
offsiteWin.focus();
return false;
});
});