var ROOT_PATH='http://www.irishcentreonline.com';
/* Main */
function wgfUpdateWidgetPositions(event, ui) {
var updates = $(this).sortable('toArray');
var parent = '';
var data = '';
for (var i = 0; i < updates.length; ++i) {
parent = document.getElementById(updates[i]).parentNode.id;
data += updates[i] + '=' + i + '_' + parent + '&';
}
data = data.substr(0, data.length - 1);
$.ajax({
url: ROOT_PATH + '/widget_update_position.php',
data: data,
type: 'post',
success: function(data) {
}
});
return true;
}
function wgfRemoveWidget(id) {
if (confirm('Remove this widget?')) {
$.ajax({
url: ROOT_PATH + '/widget_update_position.php',
data: id + '=' + 1,
type: 'post',
success: function (data) {
location.reload();
},
error: function() {
alert('Widget positions could not be saved');
}
});
}
return false;
}
function wgfLoadSortable() {
$(function() {
$( ".wgf_col" ).sortable({
connectWith: ".wgf_col",
update: wgfUpdateWidgetPositions,
handle: '.wgf_move_icon'
});
$( ".wgf_container" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
.find( ".wgf_top_mid_txt" )
.addClass( "ui-widget-header ui-corner-all" )
.prepend( "")
.end()
.find( ".wgf_content" );
/*$( ".wgf_top_mid_txt .ui-icon" ).click(function() {
$( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" );
$( this ).parents( ".wgf_container:first" ).find( ".portlet-content" ).toggle();
});*/
$( ".wgf_col" ).disableSelection();
});
}
function wgfLoadProfile(uid) {
location.href = ROOT_PATH + '/widget_test.php?max=latest_members#uid_' + uid + '__page_info';
return false
}
function wgfGetHost() {
return location.protocol + '//' + location.hostname;
}
//$(document).ready(wgfLoadSortable);
/* End Main */
/* Profile */
function wgfProfileAboutSwap(id) {
document.getElementById('wgfProfileAbout' + wgfCurProfileAboutId).style.display = 'none';
document.getElementById('wgfProfileAboutLink' + wgfCurProfileAboutId).style.color = '';
document.getElementById('wgfProfileAboutLink' + wgfCurProfileAboutId).style.fontWeight = '';
document.getElementById('wgfProfileAbout' + id).style.display = 'block';
document.getElementById('wgfProfileAboutLink' + id).style.color = '#000000';
document.getElementById('wgfProfileAboutLink' + id).style.fontWeight = 'bold';
wgfCurProfileAboutId = id;
return false;
}
function wgfProfileLoadPage(name, uid, add) {
uid = (uid ? uid : wgfProfileUid);
add = (add ? add : '');
$('#wgfProfileLoadStatus').html('
Loading...');
$.ajax({
url: ROOT_PATH + '/widget/profile_load.php',
data: 'page='+name+'&uid='+uid+add,
type: 'get',
success: function (data) {
$('#wgfProfileContent').html(data);
$('#wgfProfileLoadStatus').html('');
},
error: function() {
$('#wgfProfileLoadStatus').html('An error occurred.');
}
});
wgfProfileChangeHeight(800);
location.hash = '#uid_' + uid + '__page_' + name + (add && add.length ? '__add_' + add : '');
return false;
}
function wgfProfileChangeHeight(height) {
document.getElementById('wgfProfileLeft').style.height = height + 'px';
document.getElementById('wgfProfileRight').style.height = height + 'px';
document.getElementById('wgfProfileContent').style.height = height + 'px';
}
function wgfLoadLocationFromHash() {
var a = location.hash.replace('#', '').split('__');
var s = '';
var tpg = 'info';
var tuid = false;
var tadd = '';
for (var i = 0; i < a.length; ++i) {
s = a[i].split('_');
if (s[0] == 'uid') {
tuid = s[1];
}
else if (s[0] == 'page') {
tpg = s[1];
}
else {
add += '&' + s[0] + '=' + s[1];
}
}
wgfProfileLoadPage(tpg, tuid, tadd);
}
var wgfCurForumPage = 1;
var wgfCurUpdatePage = 1;
function wgfProfileForumPage(page) {
document.getElementById('wgfPostPage' + wgfCurForumPage).style.display = 'none';
document.getElementById('wgfPostPage' + page).style.display = '';
wgfCurForumPage = page;
return false;
}
function wgfProfileUpdatePage(page) {
document.getElementById('wgfUpdatePage' + wgfCurUpdatePage).style.display = 'none';
document.getElementById('wgfUpdatePage' + page).style.display = '';
wgfCurUpdatePage = page;
return false;
}
function wgfConnectApprove(id) {
jQuery('#btn1').css("display","none");
jQuery('#btn2').css("display","none");
jQuery('#buttons').append('
');
jQuery.get(ROOT_PATH + '/-connect_ppl.php?ajax=1',{'id':id},function(val){
if (val!=""){
jQuery('#buttons').children().css("display","none");
jQuery('#buttons').append(val);
setTimeout(wgfConnectClose, 4000);
}else{
jQuery('#buttons').children().css("display","none");
jQuery('#buttons').append('You need to login so you can connect to this member.');
}
});
return false;
}
function wgfConnectClose() {
document.getElementById('wgfProfileConnect').style.display = 'none';
return false;
}
//$(document).ready(wgfLoadLocationFromHash);
/* Emd Profile */
/* Forum */
function wgfForumQuickReply(pid, tid) {
document.getElementById('wgfForumQuickReply').style.display = '';
$('#wgfForumQuickReply').html('
Loading...');
$.ajax({
url: ROOT_PATH + '/widget/forum_quick_reply.php',
data: 'pid='+pid+'&tid='+tid,
type: 'get',
success: function (data) {
$('#wgfForumQuickReply').html(data);
document.getElementById('wgfQuickMsg').focus();
},
error: function() {
$('#wgfForumQuickReply').html('An error occurred.');
}
});
return false;
}
/* End Forum */
/* Status Updates */
function wgfStatusComment(sid) {
document.getElementById('wgfStatusComment').style.display = '';
$('#wgfStatusComment').html('
Loading...');
$.ajax({
url: ROOT_PATH + '/widget/update_reply.php',
data: 'sid='+sid,
type: 'get',
success: function (data) {
$('#wgfStatusComment').html(data);
document.getElementById('wgfCommentMsg').focus();
},
error: function() {
$('#wgfStatusComment').html('An error occurred.');
}
});
return false;
}
function wgfCommentSend(sid) {
$('#wgfStatusSendTxt').html('Sending...');
$.ajax({
url: ROOT_PATH + '/user_status_reply.php',
data: 'id='+sid+'&comment='+document.getElementById('wgfCommentMsg').value,
type: 'post',
success: function (data) {
data = data.split('yz{|');
if (data[0] == 'Success') {
wgfStatusComment(sid);
}
else {
$('#wgfStatusSendTxt').html(data[0]);
}
},
error: function() {
$('#wgfStatusSendTxt').html('An error occurred.');
}
});
return false;
}
function wgfCommentDelete(id, sid) {
$('#wgfStatusSendTxt').html('Deleting...');
$.ajax({
url: ROOT_PATH + '/user_delete_comment.php',
data: 'id='+id,
type: 'get',
success: function (data) {
if (data == 'Status message deleted') {
wgfStatusComment(sid);
}
else {
$('#wgfStatusSendTxt').html(data);
}
},
error: function() {
$('#wgfStatusSendTxt').html('An error occurred.');
}
});
return false;
}
function wgfStatusDelete(id) {
$('#wgf_mys_req').html('Deleting...');
$.ajax({
url: ROOT_PATH + '/user_delete_status.php',
data: 'id='+id,
type: 'get',
success: function (data) {
if (data == 'Status message deleted') {
location.reload();
}
else {
$('#wgf_mys_req').html(data);
}
},
error: function() {
$('#wgf_mys_req').html('An error occurred.');
}
});
return false;
}
/* End Status Updates */