/* * EquineNetwork.js Javascript Framework v0.8 * by ieWebDesigns (www.inlandempirewebdesigns.com) * Requires jQuery 1.3.2 or later. */ function EquineNetwork() { this.readCookie = function(name){ var nameEQ = name + '='; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; }; this.saveCookie = function(name, value, days){ var expires = ''; if(days){ var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); expires = '; expires=' + date.toGMTString(); } document.cookie = name + '=' + escape(value) + expires + '; path=/'; }; this.setupModal = function(){ if(!this.isModalHTML){ this.isModalHTML = true; jQuery('body').append('
'); jQuery('#equineNetwork_modal').dialog({ title: 'Send a MyEquine Message to the Seller', width: 500, height: 'auto', modal: true, autoOpen: false, draggable: true, resizable: false }); } }; this.showForm = function(msg) { if(msg == null) msg = ''; jQuery('#equineInternet-loginForm').html( 'If you do not have an account, you can register at Equine Internet.
'+ '' ); jQuery('#equineNetwork_modal').dialog('option', 'buttons', { Cancel: function(){jQuery(this).dialog('close');}, 'Register Now': function(){ jQuery(this).dialog('close'); window.open('http://www.equineinternet.com/'); } }); $('#equineNetwork_modal').dialog('open'); return; } jQuery.ajaxSetup({cache: false}); jQuery('#equineNetwork_modal').html('
');
jQuery('#equineNetwork_modal').load('/_api/ajax/contactSellerForm.php?adId='+adId);
jQuery('#equineNetwork_modal').dialog('option', 'buttons', {
Cancel: function(){jQuery(this).dialog('close');},
'Send Message': function(){
jQuery(this).dialog('option', 'buttons', {
"Close": function() {jQuery(this).dialog('close');}
});
jQuery.ajaxSetup({cache: false});
jQuery(this).load('/_api/ajax/contactSellerSend.php?_'+(new Date().valueOf()), {
adId: jQuery('#equineNetwork_adId').val(),
messageBody: jQuery('#equineNetwork_messageBody').val(),
security: jQuery('#equineNetwork_securityCode').val()
});
}
});
$('#equineNetwork_modal').dialog('open');
}
EquineNetwork.prototype.UserLoggedIn = function(){return this.userData != null;}
EquineNetwork.prototype.UserId = function(){return this.userData.id;}
EquineNetwork.prototype.Username = function(){return this.userData.username;}
EquineNetwork.prototype.UserStatus = function(){return this.userData.status;}
EquineNetwork.prototype.UserNumMessages = function(){return this.userData.num_messages;}
var equineNetwork = new EquineNetwork();