﻿Type.registerNamespace('PP2G');PP2G.EditPopup = function() {
PP2G.EditPopup.initializeBase(this);var m_type = 0;var m_id;var loading = "<span class='img_nbdr'>&nbsp;&nbsp;&nbsp;</span>";this.ShowBody = function(divHeader, param) {
if (document.noteMessages == null) document.noteMessages = new Array();var msgCtrl = divHeader.childNodes.item(2);if (document.noteMessages[divHeader.id] == null) {
document.noteMessages[divHeader.id] = msgCtrl.innerHTML;msgCtrl.innerHTML = '&nbsp;';}
else {
msgCtrl.innerHTML = document.noteMessages[divHeader.id];document.noteMessages[divHeader.id] = null;}
ToggleCollapse(divHeader, divHeader.childNodes.item(0));var bodyContainer = getNextSibling(divHeader).childNodes.item(0);if (bodyContainer.innerHTML.length == 0) {
bodyContainer.innerHTML = loading;EditPopupService1.GetNote(param, this.OnCompleteSB, this.OnErrorSB, bodyContainer);}
};this.ShowSendNewNote = function(p, dx, user) {
Initialize(dx, p, 0, 0, "New Note", false, getPTx(), user);};this.ShowSendNewNoteRR = function(p, dx, user) {
Initialize(dx, p, 0, 0, "New Note", true, getPTx(), user);};this.ShowForwardNote = function(p, s, i, dx) {
var m = getText(i) + getPT();Initialize(dx, p, 0, 6, "Forward Note", false, m, null, 'FW: ' + s);};this.ShowForwardNoteRR = function(p, s, i, dx) {
var m = getText(i) + getPT();Initialize(dx, p, 0, 6, "Forward Note", true, m, null, 'FW: ' + s);};this.ShowReplyNoteRR = function(p, id, dx) {
Initialize(dx, p, id, 1, "Reply Note", true, getPTx());};this.ShowReplyNote = function(p, id, dx) {
Initialize(dx, p, id, 1, "Reply Note", false, getPTx());};this.StarNote = function(p, pa) {
var image;for (var i = 0;i < p.childNodes.length;i++) {
var img = p.childNodes.item(i);if (img.tagName == 'IMG') {
image = img;}
}
if (!image) return;var starred = image.src.substring(image.src.length - 9) == "empty.gif";image.src = document.imageRoot + "../loading.gif";EditPopupService1.StarNote(pa, starred,
function(result) {
if (result == "") {
image.src = document.imageRoot + ((starred) ? "../star_filled.gif" : "../star_empty.gif");}
else {
image.src = document.imageRoot + ((starred) ? "../star_empty.gif" : "../star_filled.gif");alert(result);}
},
function() {
image.src = document.imageRoot + ((starred) ? "../star_empty.gif" : "../star_filled.gif");alert("Het is niet gelukt.");});};this.ShowPostComment = function(p, id, dx) {
Initialize(dx, p, id, 5, "Post Comment", false, getPTx());};this.ShowQuoteComment = function(p, id, n, i, dx) {
var m = '[q=' + n + ']' + getText(i) + '[/q]' + getPT();Initialize(dx, p, id, 5, "Post Comment", false, m);};this.ShowSendNewForumMessage = function(p, id, dx) {
Initialize(dx, p, id, 2, "New Forum Message", false, getPTx());};this.ShowReplyForumMessage = function(p, id, dx) {
Initialize(dx, p, id, 3, "Reply Forum Message", false, getPTx());};function getText(i) {
var txt = '';for (var c = 0;c < document.ubbarray.length;c++) {
if (document.ubbarray[c].i == i) {
txt = document.ubbarray[c].u;break;}
}
return txt;}
function getPT() {
var txt = document.ubbPT ? document.ubbPT : '';return txt;}
function getPTx() {
var txt = document.ubbPT ? document.ubbPT : null;return txt;}
this.ShowQuoteForumMessage = function(p, id, n, i, dx) {
var m = '[q=' + n + ']' + getText(i) + '[/q]' + getPT();Initialize(dx, p, id, 3, "Quote Forum Message", false, m);};this.ShowUpdateForumMessage = function(p, id, i, dx) {
var m = getText(i);Initialize(dx, p, id, 4, "Update Forum Message", false, m);};function subscribeSucceeded(result, p, subscribe, img, imgc) {
p.parentElement.removeChild(img);if (result == "") { imgc.src = document.imageRoot + (subscribe ? "../checked.png" : "../unchecked.png");} else { alert(result);}
}
function subscribeFailed(p, subscribe, img) {
p.parentElement.removeChild(img);alert("Het is niet gelukt.");}
function subscribe(p, pa, func) {
var imgc = p.firstChild;while (imgc.tagName != 'IMG') imgc = imgc.nextSibling;var subscribe = imgc.src.indexOf('unchecked') > 0;var img = document.createElement('IMG');img.src = document.imageRoot + "../loading.gif";p.parentElement.insertBefore(img, p);func(pa, subscribe,
function(result) {
subscribeSucceeded(result, p, subscribe, img, imgc);},
function() {
subscribeFailed(p, subscribe, img);});}
this.ForumSubscribe = function(p, pa) {
subscribe(p, pa, EditPopupService1.ForumSubscribe);};this.ForumThreadSubscribe = function(p, pa) {
subscribe(p, pa, EditPopupService1.ForumThreadSubscribe);};this.ArtistFanCreate = function(p, pa) {
subscribe(p, pa, EditPopupService1.ArtistFanCreation);};this.UAvailable = function(p, pa, u) {
pa = $get(pa);var img = document.createElement('IMG');img.src = document.imageRoot + "../loading.gif";pa.innerHTML = '';pa.appendChild(img);if (u == null) u = 0;UserService1.NameAvailable(p.value, u,
function(result) {
pa.innerHTML = result;},
function() {
pa.innerHTML = "Oops, that didn't work...";},
function() {
pa.innerHTML = "Oops, that didn't work...";});};this.GAvailable = function(p, pa) {
pa = $get(pa);var img = document.createElement('IMG');img.src = document.imageRoot + "../loading.gif";pa.innerHTML = '';pa.appendChild(img);UserService1.GroupAvailable(p.value,
function(result) {
pa.innerHTML = result;},
function() {
pa.innerHTML = "Oops, that didn't work...";},
function() {
pa.innerHTML = "Oops, that didn't work...";});};this.NRelate = function(p, pa) {
_relate(p, pa, UserService1.GetNewsItems);};this.ERelate = function(p, pa) {
_relate(p, pa, UserService1.GetEventItems);};function _relate(p, pa, func) {
pa = $get(pa);var img = document.createElement('IMG');img.src = document.imageRoot + "../loading.gif";pa.innerHTML = '';pa.appendChild(img);func(p.value,
function(result) {
pa.innerHTML = "<div style='font-size:8px; align:right;'>";for (var i = 0;i < result.length;i++) {
pa.innerHTML += String.format("{1:dd-MM-yyyy} <a href='{0}' target='_blank'>{2}</a><br />", result[i].Url, result[i].Date, result[i].Tooltip);}
pa.innerHTML += "</div>";},
function() {
pa.innerHTML = "Oops, that didn't work...";},
function() {
pa.innerHTML = "Oops, that didn't work...";});}
this.HideDialog = function(p) {
var behavior = $find("editPopupBehavior");behavior.hide();var editor = $find('editorMan');editor.hide();};this.ReShowDialog = function(p) {
var behavior = $find("editPopupBehavior");behavior.show();};function showHideControl(ctrlID, visible) {
if (visible) {
DisplayResetDiv(ctrlID);}
else {
RemoveDiv(ctrlID);}
}
function Initialize(dx, p, id, type, title, rre, m, user, sub) {
SetupUI(dx);m_id = id;m_type = type;var titleDiv = $get("editPopupHandle");titleDiv.innerHTML = title;var focusid;if (m_type == 0 || m_type == 6) {
showHideControl('editPopupUserNameRow', !user);showHideControl('editPopupSubjectRow', true);showHideControl('editPopupUserName', !user);showHideControl('editPopupSubject', true);showHideControl('rr', true);showHideControl('rrlabel', true);if (user)
focusid = 'editPopupSubject';else
focusid = 'editPopupUserName';}
else if (m_type == 1) {
showHideControl('editPopupUserNameRow', false);showHideControl('editPopupSubjectRow', false);showHideControl('editPopupUserName', false);showHideControl('editPopupSubject', false);showHideControl('rr', true);showHideControl('rrlabel', true);focusid = 'editPopupMessage';}
else if (m_type == 2 || m_type == 3 || m_type == 4 || m_type == 5) {
showHideControl('editPopupUserNameRow', false);showHideControl('editPopupSubjectRow', m_type == 2);showHideControl('editPopupUserName', false);showHideControl('editPopupSubject', m_type == 2);showHideControl('rr', false);showHideControl('rrlabel', false);if (m_type == 2)
focusid = 'editPopupSubject';else
focusid = 'editPopupMessage';}
var rr = $get("rr");if (!rre) {
rr.disabled = true;}
ShowDialog(p);if (focusid)
$get(focusid).focus();if (m) {
$get("editPopupMessage").value = m;}
if (user) {
$find("editPopupUsernameWatermark").set_Text(user);}
if (sub) {
$find("editPopupSubjectWatermark").set_Text(sub);}
};function SetupUI(dx) {
if ($get('editPopup')) return;var div = document.createElement('DIV');div.innerHTML = "<div id='editPopupStatus' class='editPopupStatus'></div>";safeAppendChild(div.firstChild);div.innerHTML = "<div id='editPopup' class='editPopup floatwindow'><div id='editPopupHandle' class='draghandle'>Title</div><table class='tableNormal' cellspacing='2' cellpadding='0'><colgroup><col width='60' align='right'><col width='200' align='left'><col width='20' align='left'></colgroup><tr id='editPopupUserNameRow'><td valign='middle' style='width:80px;'>User(s):</td><td valign='middle'><input type='text' size='60' id='editPopupUserName' tabindex='1' /><br /><span style='font-size:8;'>; separate your friends (PP2G Deluxe only)</span></td><td valign='middle'><span style='color: red'>*</td></tr><tr id='editPopupSubjectRow'><td valign='middle' style='width:80px; display: block;'>Subject:</td><td valign='middle'><input type='text' size='60' maxlength='80' id='editPopupSubject' tabindex='2' /></td><td valign='middle'></td></tr><tr><td align='left'>Message:</td><td colspan='2' align='right'><label id='rrlabel' for='rr' style='font-size:8;'>Read receipt (PP2G Deluxe only):</label><input type='checkbox' id='rr' class='inlineEditLabel nobdr' tabindex='3' /></td></tr><tr><td colspan='3' align='left'><textarea rows='10' cols='85' id='editPopupMessage' maxlength='4096' tabindex='4'></textarea></td></tr></table><div><center><a href='javascript://' class='button' id='okEditPopup' onclick='EPSend(); return false;' tabindex='5'>Ok</a>&nbsp;<a href='javascript://' class='button' onclick='EPHide(); return false;' tabindex='6'>Cancel</a></center></div></div>";div = div.firstChild;safeAppendChild(div);$create(PP2G.EditorBehavior, { 'AllowDX': dx, 'InstantShow': true }, null, null, $get('editPopupMessage'));$create(AjaxControlToolkit.PopupBehavior, { 'id': 'editPopupBehavior', "positioningMode": AjaxControlToolkit.PositioningMode.BottomRight }, null, null, div);$create(AjaxControlToolkit.PopupBehavior, { 'id': 'editPopupStatusBehavior', "positioningMode": AjaxControlToolkit.PositioningMode.Center }, null, null, $get("editPopupStatus"));$create(AjaxControlToolkit.FloatingBehavior, { "handle": $get("editPopupHandle"), "id": "editPopupFloatBehavior" }, null, null, div);$create(AjaxControlToolkit.TextBoxWatermarkBehavior, { "WatermarkText": "Enter an username here", "id": "editPopupUsernameWatermark" }, null, null, $get("editPopupUserName"));$create(AjaxControlToolkit.TextBoxWatermarkBehavior, { "WatermarkText": "Enter a subject here", "id": "editPopupSubjectWatermark" }, null, null, $get("editPopupSubject"));$create(AjaxControlToolkit.AutoCompleteBehavior, { "id": "editPopupUserNameAutoEx", "completionListCssClass": "autocomplete_completionListElement", "completionListItemCssClass": "autocomplete_listItem", "highlightedItemCssClass": ".autocomplete_highlightedListItem", "minimumPrefixLength": 1, "delimiterCharacters": ";", "servicePath": document.imageRoot + "../../mypp2g/notes/EditPopupService1.asmx", "serviceMethod": "GetFriendsFilteredList",
"onHide": "{'AnimationName':'Parallel','Duration':'.4','AnimationChildren':[{'AnimationName':'FadeOut'},{'AnimationName':'Length','PropertyKey':'height','StartValueScript':'$find(\\u0027editPopupUserNameAutoEx\\u0027)._height','EndValue':'0'}]}",
"onShow": "{'AnimationName':'Sequence','AnimationChildren':[{'AnimationName':'OpacityAction','Opacity':'0'},{'AnimationName':'HideAction','Visible':'true'},{'AnimationName':'ScriptAction','Script':'var behavior = $find(\\u0027editPopupUserNameAutoEx\\u0027);if (!behavior._height){var target = behavior.get_completionList();behavior._height = target.offsetHeight;target.style.height = \\u00270px\\u0027;}'},{'AnimationName':'Parallel','Duration':'.4','AnimationChildren':[{'AnimationName':'FadeIn'},{'AnimationName':'Length','PropertyKey':'height','StartValue':'0','EndValueScript':'$find(\\u0027editPopupUserNameAutoEx\\u0027)._height'}]}]}"
}, null, null, $get("editPopupUserName"))
propertyChangedHandler = Function.createDelegate(this, _onPropertyChangedHandler);$find('editPopupFloatBehavior').add_propertyChanged(propertyChangedHandler);}
this.dispose = function() {
var e = $find('editPopupFloatBehavior');if (e) e.remove_propertyChanged(propertyChangedHandler);PP2G.EditPopup.callBaseMethod(this, 'dispose');}
var propertyChangedHandler;function _onPropertyChangedHandler(sender, e) {
var prop = e.get_propertyName();if (prop == "location")
$find('editorMan').updateLocations();}
function Clear() {
$find("editPopupUsernameWatermark").set_Text("");$find("editPopupSubjectWatermark").set_Text("");$get("editPopupMessage").value = "";}
function ShowDialog(p) {
Clear();showStatus('', true);var behavior = $find("editPopupBehavior");behavior.set_parentElement(p);behavior.show();}
this.Send = function() {
var userName = $get("editPopupUserName");var subject = $get("editPopupSubject");var message = $get("editPopupMessage");var rr = $get("rr");if (m_type == 0 || m_type == 6) {
if (userName.value == '' || userName.value == $find("editPopupUsernameWatermark").get_WatermarkText()) {
alert("Enter an username.");return;}
}
if (m_type == 2) {
if (subject.value == '' || subject.value == $find("editPopupSubjectWatermark").get_WatermarkText()) {
alert("Enter a subject.");return;}
}
if (message.value == '') {
alert("Enter a message.");return;}
if (message.value.length > 4096) {
alert("Shorten your message, your message is larger than 4096 characters: " + message.value.length);return;}
showStatus("<span class='img_nbdr'>&nbsp;&nbsp;&nbsp;</span>&nbsp;Sending...");if (m_type == 0 || m_type == 6)
EditPopupService1.AddNote(userName.value, subject.value, message.value, rr.checked, this.OnComplete, this.OnError, this);else if (m_type == 1)
EditPopupService1.ReplyNote(m_id, message.value, rr.checked, this.OnComplete, this.OnError, this);else if (m_type == 2 || m_type == 3)
EditPopupService1.ForumPost(m_id, subject.value, message.value, this.OnComplete, this.OnError, this);else if (m_type == 4)
EditPopupService1.ForumUpdate(m_id, subject.value, message.value, this.OnComplete, this.OnError, this);else if (m_type == 5)
EditPopupService1.CommentPost(m_id, message.value, this.OnComplete, this.OnError, this);this.HideDialog();};function showStatus(txt, hide, fadeout, timer) {
var resultMessage = $get("editPopupStatus");if (resultMessage) {
resultMessage.innerHTML = txt;if (hide) {
var b = $find("editPopupStatusBehavior");b.hide();}
else {
var editPopup = $get('editPopup');var bounds = GetBounds(editPopup);if (bounds.width != 0) {
var loc = GetLocation(editPopup);SetLocation(resultMessage, loc);resultMessage.style.width = bounds.width + "px";resultMessage.style.height = bounds.height + "px";resultMessage.style.lineHeight = bounds.height + "px";}
var b = $find("editPopupStatusBehavior");b.set_parentElement($get("editPopup"));b.set_onShow("{'AnimationName':'Sequence','AnimationChildren':[{'AnimationName':'OpacityAction', 'Opacity':'100'},{'AnimationName':'HideAction','Visible':'true'}]}");b.show();if (fadeout) {
b.set_onHide("{'AnimationName':'Sequence','AnimationChildren':[{'AnimationName':'FadeOut','Duration':'" + (timer ? timer : .8) + "'},{'AnimationName':'HideAction'}]}");b.hide();}
else {
b.set_onHide(null);}
}
}
}
this.OnComplete = function(result, userContext) {
if (result == "") {
showStatus("Sending complete.", false, true);Clear();var behavior = $find("editPopupBehavior");var p = behavior.get_parentElement();if (p && p.href && p.href.startsWith('javascript:') && !p.href.startsWith('javascript://')) {
window.setTimeout(p.href.substring(11));}
else
__doPostBack('', '');}
else
userContext.OnError(result, userContext);};this.OnError = function(result, userContext) {
showStatus(result + " Try it again...", false, true, 2);userContext.ReShowDialog();};this.OnCompleteSB = function(result, userContext) {
if (document.parserMan)
userContext.innerHTML = document.parserMan.ParseUBB(result);};this.OnErrorSB = function(result, userContext) {
showStatus("Oops failed. Try it again...", false, true, 2);};}
PP2G.EditPopup.registerClass('PP2G.EditPopup', Sys.Component);function EPSend() { $find('editPopupMan').Send();}
function EPHide() { $find('editPopupMan').HideDialog();}
function ImagePopupController()
{ 
this.Show = function ( obj, param, offsetLeft, offsetTop, parentOffset)
{ 
ShowImagePopup(obj, param, offsetLeft, offsetTop, parentOffset);};this.Hide = function () 
{ 
HideFrame();};var anchor;function ShowImagePopup( obj, url, title, OffsetLeft, OffsetTop, ControlOffset) 
{
setupUI();var oCtrl = $get('divImagePopup');var td = $get('tdImagePopup');td.innerHTML = String.format("<img onload='document.imgP.Center();' src='{0}' alt='Close' style='float:right' onclick='document.imgP.Hide();'>", url);td = $get('tdImagePopupTitle');td.innerHTML = title;anchor = obj;document.imgP.Center();ShowDiv('divImagePopup');}
this.Center = function()
{
var loc = GetLocation( anchor);var objLeft = loc.x;var objTop = loc.y;var objHeight = anchor.offsetHeight;var objWidth = anchor.offsetWidth;var div = $get('divImagePopup');var x = (objLeft + (objWidth / 2) - (div.offsetWidth / 2));var y = (objTop + (objHeight / 2) - (div.offsetHeight / 2));if ( x < 0) x = 0;if ( y < 0) y = 0;div.style.left = x + 'px';div.style.top = y + 'px';div.style.zIndex = 100;}
function HideFrame() 
{
if ( ui)
{
HideDiv('divImagePopup');var oCtrl = $get('tdImagePopup');oCtrl.innerHTML = "";oCtrl = $get('tdImagePopupTitle');oCtrl.innerHTML = "";}
}
var ui = false;function setupUI()
{
if ( !ui)
{
var div = document.createElement('DIV');div.innerHTML = String.format( "<div id='divImagePopup' class='imagePopup' style='background-color: #AAA; position:absolute; left:0; top:0;'><div class='bgSection'><table cellspacing='0' cellpadding='2' border='0' bgcolor='#ffffff'><tr id='imgPopupHandle' class='imagePopupHeader bgSection'><td id='tdImagePopupTitle'></td><td><img alt='Close' style='float:right' src='{0}../icn_close_white.gif' onclick='document.imgP.Hide();'></td></tr><tr><td colspan='2' id='tdImagePopup'></td></tr></table></div></div>", document.imageRoot);div = div.firstChild;safeAppendChild( div);$create(AjaxControlToolkit.FloatingBehavior, {"handle":$get("imgPopupHandle")}, null, null, div);ui = true;}
}
}
document.imgP = new ImagePopupController();function TooltipController()
{
this.Show = function ( obj, sContent, offsetLeft, offsetTop, parentOffset)
{ 
ShowToolTip( 'divToolTip', obj, sContent, offsetLeft, offsetTop, parentOffset);};this.Hide = function ( id, html) 
{ 
HideToolTip( 'divToolTip');};function ShowToolTip( sDivName, obj, sContent, OffsetLeft, OffsetTop, ControlOffset) 
{
if ( !SetupUI()) return;oToolTip = $get(sDivName);oArrow = $get(sDivName + 'Arrow');ControlOffset = ControlOffset == undefined? 2: ControlOffset;OffsetLeft = OffsetLeft == undefined? 0: OffsetLeft;OffsetTop = OffsetTop == undefined? 0: OffsetTop;var loc = GetLocation( obj);var objLeft = loc.x;var objTop = loc.y;var objHeight = obj.offsetHeight;var objWidth = obj.offsetWidth;oArrow.style.left = (objLeft + objWidth + 12 + OffsetLeft) + 'px';oArrow.style.top = objTop + (objHeight/2) + 'px';oToolTip.style.left = (objLeft + objWidth + 15 + OffsetLeft) + 'px';oToolTip.style.top = (objTop + OffsetTop) + 'px';oToolTip.innerHTML = sContent;ShowDiv(sDivName + 'Arrow');ShowDiv(sDivName);}
function HideToolTip( sDivName ) 
{
if ( ui)
{
HideDiv(sDivName + 'Arrow');HideDiv(sDivName);}
}
var ui = false;function SetupUI()
{
if ( !ui)
{
ui = true;var div = document.createElement('DIV');safeAppendChild( div);div.innerHTML = String.format( "<div id='divToolTip'></div><div id='divToolTipArrow'><img src='{0}../arrow_tooltip_left.gif' /></div>", document.imageRoot);}
return true;}
}
document.ttc = new TooltipController();function LinkController()
{
var loading = "<span class='img_nbdr'>&nbsp;&nbsp;&nbsp;</span>";this.SetLinkRate = function (rateObject, args) 
{ 
var param = rateObject.get_value();var rating = rateObject.get_rating();var obj = rateObject.get_element();obj.innerHTML = loading;EditPopupService1.SetLinkRate(param, rating, this.OnCompleteSLR, this.OnError, obj);};this.SetVideoRate = function (rateObject, args) 
{ 
var param = rateObject.get_value();var rating = rateObject.get_rating();var obj = rateObject.get_element();obj.innerHTML = loading;EditPopupService1.SetVideoRate(param, rating, this.OnCompleteSLR, this.OnError, obj);};this.SetReport = function (obj, param) 
{ 
obj = obj.parentNode;obj.innerHTML = loading;EditPopupService1.SetLinkReport(param, this.OnCompleteSLR, this.OnError, obj);};this.ShowReport = function (obj, param) 
{ 
obj = obj.parentNode;obj.innerHTML = loading;EditPopupService1.GetLinkReport(param, this.OnCompleteGLR, this.OnError, obj);};this.OnCompleteGLR = function( result, userContext) 
{
if ( result)
{
var html = "Reason: <select onchange='document.lcr.SetReport(this, this.options[this.selectedIndex].value);return false;'>";for( var i = 0;i < result.length;i++)
{
html += String.format( "<option value='{0}'>{1}</option>", result[i].ID, result[i].Name);}
html += "</select>";userContext.innerHTML = html;}
else
this.OnError()
};this.OnCompleteSLR = function( result, userContext) 
{
userContext.innerHTML = result;};this.OnError = function ( result, userContext) 
{
userContext.innerHTML = "Oops an error. Try it again...";};this.AddVideoFavorite = function (obj, param) 
{ 
obj = obj.parentNode;obj.innerHTML = loading;EditPopupService1.AddVideoFavorite(param, this.OnCompleteSLR, this.OnError, obj);};this.RemoveVideoFavorite = function (obj, param) 
{ 
obj = obj.parentNode;obj.innerHTML = loading;EditPopupService1.RemoveVideoFavorite(param, this.OnCompleteSLR, this.OnError, obj);};this.AddVideoUserSubscription = function (obj, param) 
{ 
obj = obj.parentNode;obj.innerHTML = loading;EditPopupService1.AddVideoUserSubscription(param, this.OnCompleteSLR, this.OnError, obj);};this.RemoveVideoUserSubscription = function (obj, param) 
{ 
obj = obj.parentNode;obj.innerHTML = loading;EditPopupService1.RemoveVideoUserSubscription(param, this.OnCompleteSLR, this.OnError, obj);};function doQuicklist(obj, param, func, callback)
{
var ref = this;obj = obj.parentNode;obj.innerHTML = loading;var f = callback != undefined ? callback : 
function (result)
{
obj.innerHTML = result[0];var ql = $get('quicklist');if ( ql != null)
{
ql.innerHTML = result[1];ql.style.display = ( result[1] == "")?"none":"block";}
};func(param, 
f, 
ref.OnError, obj);}
function QuicklistCB(obj, callback)
{
obj = obj.parentNode;obj.innerHTML = loading;var f = callback != undefined ? callback : 
function (result)
{
if ( result[0])
{
obj.innerHTML = result[0];var ql = $get('quicklist');if ( ql != null)
{
ql.innerHTML = result[1];ql.style.display = ( result[1] == "")?"none":"block";}
}
else
{
obj.innerHTML = result;}
$find("quicklistPopupExtender").hide();};return f;}
function doQuicklist1(obj, param, func, callback)
{
var ref = this;var f = QuicklistCB(obj, callback);func(param, 
f, 
ref.OnError, obj);}
function doQuicklist2(obj, param, param2, func, callback)
{
var ref = this;var f = QuicklistCB(obj, callback);func(param, param2,
f, 
ref.OnError, obj);}
function doQuicklist4(obj, param, param2, param3, param4, func, callback)
{
var ref = this;var f = QuicklistCB(obj, callback);func(param, param2, param3, param4,
f, 
ref.OnError, obj);}
var quicklistObj;var quicklistParam;function setupquicklistUI(obj,param)
{
quicklistObj = obj;quicklistParam = param;var quicklistPopupExtender = $find("quicklistPopupExtender");if ( !quicklistPopupExtender)
{
var html = document.createElement('DIV');html.innerHTML = "<div id='quicklistPopup' class='ContentContainer stylePopup' style='display:none'><div><div class='TitleContainer bgSection imagePopupHeader' style='width:350px' id='quicklistDragHandle' >" + userLanguage("Add to playlist", "Voeg toe aan playlist") + "</div><div style='display:none;' id='quicklistPopupError' class='stylePopupError'><div id='quicklistPopupErrorTxt'></div></div><div id='quicklistAddDiv'><div>" + userLanguage( "Choose a playlist or create a new one.", "Selecteer een playlist of maak een nieuwe.") + "</div><div id='quicklistList'></div></div><div id='quicklistNewDiv'><table><tr><td align='right'>" + userLanguage("Name:","Naam:") + "</td><td><input type='text' id='quicklistPopupName' style='width:440px;' maxLength='50' /></td></tr><tr><td align='right' valign='top'>" + userLanguage("Description:","Omschrijving:") + "</td><td><textarea rows='6' cols='85' id='quicklistPopupDescription' maxlength='4096'></textarea></td></tr><tr><td align='right'>" + userLanguage("Private:","Prive:") + "</td><td><input type='checkbox' id='quicklistPopupPrivate' class='nobdr' /></td></tr></table></div><br /><div><a href='javascript://' class='button' id='quicklistPopupOK' onclick='document.lcr.AddPlaylist(); return false;'>" + userLanguage("ADD","VOEG TOE") + "</a>&nbsp;<a href='javascript://' class='button' id='quicklistPopupCancel'>" + userLanguage("CANCEL","ANNULEER") + "</a>&nbsp;<a href='javascript://' class='button' id='quicklistPopupNew' onclick='document.lcr.ShowNewPlaylist(); return false;'>" + userLanguage("NEW ONE...","NIEUWE...") + "</a></div></div></div>";safeAppendChild( html);quicklistPopupExtender = $create(AjaxControlToolkit.ModalPopupBehavior, {"BackgroundCssClass":"stylePopupBack","CancelControlID":"quicklistPopupCancel","DropShadow":false,"PopupControlID":"quicklistPopup","PopupDragHandleControlID":"quicklistDragHandle","id":"quicklistPopupExtender"}, null, null, obj);quicklistPopupExtender._show = quicklistPopupExtender.show;quicklistPopupExtender.show = function() { toggleDA(false);this._show();};quicklistPopupExtender._hide = quicklistPopupExtender.hide;quicklistPopupExtender.hide = function() { toggleDA(true);this._hide();};}
$get('quicklistPopupOK').enabled = true;$get('quicklistDragHandle').style.width = '350px';$get('quicklistPopupNew').style.display = '';RemoveDiv('quicklistNewDiv');RemoveDiv('quicklistPopupError');DisplayDiv('quicklistAddDiv');$get('quicklistPopupErrorTxt').innerHTML = '';quicklistPopupExtender.show();}
this.ShowNewPlaylist = function()
{
$get('quicklistDragHandle').style.width = '550px';$get('quicklistPopupNew').style.display = 'none';$get('quicklistPopupName').value = '';$get('quicklistPopupDescription').value = '';$get('quicklistPopupPrivate').checked = false;DisplayDiv('quicklistNewDiv');RemoveDiv('quicklistAddDiv');}
this.AddPlaylist = function()
{
if ( $get('quicklistNewDiv').style.display == 'none')
{
$get('quicklistPopupOK').enabled = false;var dd = $get('quicklistDD');if ( dd.selectedIndex == 0)
{
doQuicklist1( quicklistObj, quicklistParam, EditPopupService1.AddQuicklist);}
else
{
doQuicklist2( quicklistObj, quicklistParam, dd.options[dd.selectedIndex].value, EditPopupService1.AddToPlaylist);}
}
else
{
if ( $get('quicklistPopupName').value.trim().length == 0)
{
alert( userLanguage('A playlist name is required.','Een playlist naam is verplicht.'));return;}
$get('quicklistPopupOK').enabled = false;doQuicklist4( quicklistObj, quicklistParam, $get('quicklistPopupName').value, $get('quicklistPopupDescription').value, $get('quicklistPopupPrivate').checked, EditPopupService1.AddPlaylist);}
}
this.AddQuicklist = function (obj, param) 
{ 
setupquicklistUI(obj, param);var f = function (result)
{
var options = '';for(var i = 0;i < result.length;i++)
{
options += "<option value='" + result[i].f + "'>" + result[i].s.replace("<|>","") + "</option>";}
$get('quicklistList').innerHTML = "<select id='quicklistDD'>" + options + "</select>";};var obj = $get('quicklistList');obj.innerHTML = loading;EditPopupService1.GetPlaylists( f, this.OnError, obj);};this.RemoveQuicklist = function (obj, param) 
{ 
doQuicklist( obj, param, EditPopupService1.RemoveQuicklist);};this.SortQuicklist = function (obj, param, toLeft) 
{ 
var f = function(p,r,t,e,n,o) { EditPopupService1.SortQuicklist(p,toLeft,r,t,e,n,o) };doQuicklist( obj, param, f);};this.ClearQuicklist = function (obj) 
{ 
var f = function(p,r,t,e,n,o) { EditPopupService1.ClearQuicklist(r,t,e,n,o) };doQuicklist( obj, null, f);};this.ShareVideo = function (obj, param) 
{
shareParam = param;shareFunc = EditPopupService1.ShareVideo;setupShareUI(obj,0);};this.SharePlaylist = function (obj, param) 
{
shareParam = param;shareFunc = EditPopupService1.SharePlaylist;setupShareUI(obj,1);};var shareFunc;var shareParam;var shareObj;function setupShareUI(obj)
{
shareObj = obj;var sharePopupExtender = $find("sharePopupExtender");if ( !sharePopupExtender)
{
var html = document.createElement('DIV');html.innerHTML = "<div id='sharePopup' class='ContentContainer stylePopup' style='display:none'><div><div class='TitleContainer bgSection' style='width:450px' id='shareDragHandle' >PP2G TV Share</div><div style='display:none;' id='sharePopupError' class='stylePopupError'><div id='sharePopupErrorTxt'></div></div><div>" + userLanguage( "Enter usernames and/or emailaddresses separated by a , (comma)", "Vul usernamen en/of emailadressen in, gescheiden door een , (comma)") + "</div><div><textarea rows='2' cols='85' id='sharePopupTo' maxlength='4096'></textarea></div><div>" + userLanguage("Enter a message","Vul een bericht in") + "</div><div><textarea rows='6' cols='85' id='sharePopupMessage' maxlength='4096'>Check this out at PP2G TV!</textarea></div><div><a href='javascript://' class='button' id='sharePopupOK' onclick='document.lcr.SendShareVideo(); return false;'>" + userLanguage("SEND","VERSTUUR") + "</a>&nbsp;<a href='javascript://' class='button' id='sharePopupCancel'>" + userLanguage("CANCEL","ANNULEER") + "</a></div></div></div>";safeAppendChild( html);sharePopupExtender = $create(AjaxControlToolkit.ModalPopupBehavior, {"BackgroundCssClass":"stylePopupBack","CancelControlID":"sharePopupCancel","DropShadow":false,"PopupControlID":"sharePopup","PopupDragHandleControlID":"shareDragHandle","id":"sharePopupExtender"}, null, null, obj);}
RemoveDiv('sharePopupError');$get('sharePopupErrorTxt').innerHTML = '';sharePopupExtender.show();}
this.SendShareVideo = function()
{
var to = $get('sharePopupTo').value;var message = $get('sharePopupMessage').value;if ( to.length == 0 || message.length == 0) return;$get('sharePopupOK').enabled = false;DisplayDiv('sharePopupError');var obj = $get('sharePopupErrorTxt');obj.innerHTML = loading;shareFunc(shareParam, to, message, this.OnCompleteSSV, this.OnError, obj);}
this.OnCompleteSSV = function( result, userContext) 
{
$get('sharePopupOK').enabled = true;if ( result.length == 0)
{
shareObj.parentElement.innerHTML = userLanguage("The emails and notes are sent","De emails en notes zijn verstuurd");$find("sharePopupExtender").hide();}
else
userContext.innerHTML = result;};this.ReportAbuse = function (obj, al, param) 
{
abuseParam = param;setupAbuseUI(obj, al);};var abuseParam;var abuseObj;function setupAbuseUI(obj, al)
{
abuseObj = obj;var abusePopupExtender = $find("abusePopupExtender");if ( !abusePopupExtender)
{
var html = document.createElement('DIV');var cv = document.aid == 2 ? "<option value='15'>" + userLanguage("Copyright Violation","Copyright schending") + "</option>" : "";html.innerHTML = "<div id='abusePopup' class='ContentContainer stylePopup' style='display:none'><div><div class='TitleContainer bgSection imagePopupHeader' style='width:450px' id='abuseDragHandle' >" + userLanguage("Report Abuse", "Meld Misbruik") + "</div><div style='display:none;' id='abusePopupError' class='stylePopupError'><div id='abusePopupErrorTxt'></div></div><div>" + userLanguage( "What do you want to report to PP2G?", "Wat wil je melden aan PP2G?") + "</div><div><select id='abuseType'><option value='-1'>" + userLanguage("Make a choice","Maak een keuze") + "</option><option value='10'>" + userLanguage("Pornography","Pornografie") + "</option>" + cv + "<option value='20'>" + userLanguage("Racism","Racisme") + "</option><option value='30'>" + userLanguage("Prohibited (Illegal)","Verboden (Illegaal)") + "</option><option value='40'>" + userLanguage("Violent","Gewelddadig") + "</option><option value='100'>" + userLanguage("Other...","Anders...") + "</option></select></div><div>" + userLanguage("Explain thoroughly why this item/page is wrong.<br />Reporting useless reports can block you!","Verklaar uitvoerig waarom dit item/pagina niet goed is.<br />Onzinnige meldingen kunnen je een blokkade opleveren!") + "</div><div><textarea rows='6' cols='85' id='abusePopupMessage' maxlength='4096'></textarea></div><div><a href='javascript://' class='button' id='abusePopupOK' onclick='document.lcr.SendAbuseReport(); return false;'>" + userLanguage("SEND","VERSTUUR") + "</a>&nbsp;<a href='javascript://' class='button' id='abusePopupCancel'>" + userLanguage("CANCEL","ANNULEER") + "</a></div></div></div>";safeAppendChild( html);abusePopupExtender = $create(AjaxControlToolkit.ModalPopupBehavior, {"BackgroundCssClass":"stylePopupBack","CancelControlID":"abusePopupCancel","DropShadow":false,"PopupControlID":"abusePopup","PopupDragHandleControlID":"abuseDragHandle","id":"abusePopupExtender"}, null, null, obj);abusePopupExtender._show = abusePopupExtender.show;abusePopupExtender.show = function() { toggleDA(false);this._show();};abusePopupExtender._hide = abusePopupExtender.hide;abusePopupExtender.hide = function() { toggleDA(true);this._hide();};}
RemoveDiv('abusePopupError');$get('abusePopupErrorTxt').innerHTML = '';abusePopupExtender.show();}
this.SendAbuseReport = function()
{
var _t = $get('abuseType')
var t = parseInt(_t.options[_t.selectedIndex].value);var message = $get('abusePopupMessage').value;if ( t < 1 || message.length == 0) return;$get('abusePopupOK').enabled = false;DisplayDiv('abusePopupError');var obj = $get('abusePopupErrorTxt');obj.innerHTML = loading;EditPopupService1.ReportAbuse(abuseParam, t, message, this.OnCompleteSAR, this.OnError, obj);}
this.OnCompleteSAR = function( result, userContext) 
{
$get('abusePopupOK').enabled = true;if ( result.length == 0)
{
abuseObj.parentElement.innerHTML = userLanguage("Your abuse report has been sent","Je misbruik melding is verstuurd");$get('abuseType').selectedIndex = 0;$get('abusePopupMessage').value = '';$find("abusePopupExtender").hide();}
else
userContext.innerHTML = result;};}
document.lcr = new LinkController();function CalController()
{
var calItems = new Array();var calItemsFetched = new Array();this.create = function( id, cals, date, selDate, css, cssHdr, cssDayHdr, cssDay, calDaySelected, calToday)
{
this.createMonth( id, cals, date, selDate, css, cssHdr, cssDayHdr, cssDay, calDaySelected, calToday);};this.createMonth = function(id, cals, date, selDate, css, cssHdr, cssDayHdr, cssDay, calDaySelected, calToday)
{
date = new Date( Date.UTC(date.getFullYear(), date.getMonth(), 1));var lastDate = new Date( Date.UTC(date.getFullYear(), date.getMonth() + cals, 1));lastDate = new Date(lastDate.valueOf() - 86400000);var tag = 'events';if ( calItemsFetched[ tag + date] == null)
{
var context = new Object();context.Tag = tag;context.Func = function() { document.clc.displayMonth(id, cals, date, selDate, css, cssHdr, cssDayHdr, cssDay, calDaySelected, calToday, tag);};context.Date = date;UserService1.GetEvents( date, lastDate, this.OnCompleteCS, this.OnErrorCS, context);}
else
{
this.displayMonth( id, cals, date, selDate, css, cssHdr, cssDayHdr, cssDay, calDaySelected, calToday, tag);}
}
this.displayMonth = function(id, cals, date, selDate, css, cssHdr, cssDayHdr, cssDay, calDaySelected, calToday, tag)
{
var html = "<table><tr align='center'>";for ( var i = 0;i < cals;i++)
{
date = new Date( Date.UTC(date.getFullYear(), date.getMonth() + i, 1));var lastDate = new Date( Date.UTC(date.getFullYear(), date.getMonth() + 1 + i, 1));lastDate = new Date(lastDate.valueOf() - 86400000);html += "<td valign='top'>";html += this.createSingleMonth( id, i, cals, date, lastDate, selDate, css, cssHdr, cssDayHdr, cssDay, calDaySelected, calToday, tag);html += "</td>";}
html += "</tr></table>";var elem = $get( id);if (Sys.Browser.agent == Sys.Browser.InternetExplorer)
{
if ( !elem.style.filter)
elem.style.filter = 'progid:DXImageTransform.Microsoft.Slide(slideStyle="PUSH", bands=1, duration=0.75)';if ( elem.filters)
elem.filters[0].Apply();}
elem.innerHTML = html;if (Sys.Browser.agent == Sys.Browser.InternetExplorer)
{
if ( elem.filters)
elem.filters[0].Play();}
}
this.createSingleMonth = function( id, calSeq, cals, date, lastDate, selDate, css, cssHdr, cssDayHdr, cssDay, calDaySelected, calToday, tag)
{
var html = String.format('<table width="100%" class="{0}">', css);html += String.format('<tr align="center" class="{0}"><td colspan="8"><table class="{0}" width="100%"><tr>', cssHdr);if ( calSeq == 0)
html += String.format('<td align="left" style="cursor: pointer;" onclick="document.clc.create(\'{2}\',{11},new Date({3},{4}-{11},1),new Date({8}),\'{5}\',\'{1}\',\'{6}\',\'{7}\',\'{9}\',\'{10}\')">PREV</td>', date, cssHdr, id, date.getFullYear(), date.getMonth(), css, cssDayHdr, cssDay, Date.UTC(selDate.getFullYear(), selDate.getMonth(), selDate.getDate()), calDaySelected, calToday, cals);else
html += '<td>&nbsp;</td>';html += String.format('<td>{0:y}</td>', date);if ( calSeq + 1 == cals)
html += String.format('<td align="right" style="cursor: pointer;" onclick="document.clc.create(\'{2}\',{11},new Date({3},{4}+1,1),new Date({8}),\'{5}\',\'{1}\',\'{6}\',\'{7}\',\'{9}\',\'{10}\')">NEXT</td>', date, cssHdr, id, date.getFullYear(), date.getMonth(), css, cssDayHdr, cssDay, Date.UTC(selDate.getFullYear(), selDate.getMonth(), selDate.getDate()), calDaySelected, calToday, cals);else
html += '<td>&nbsp;</td>';html += '</tr></table></td></tr>';var weekstart = 1;var dtf = Sys.CultureInfo.CurrentCulture.dateTimeFormat;html += String.format( '<tr align="center" class="{7}"><td>wk</td><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td></tr>', dtf.AbbreviatedDayNames[(0+weekstart)%7], dtf.AbbreviatedDayNames[(1+weekstart)%7], dtf.AbbreviatedDayNames[(2+weekstart)%7], dtf.AbbreviatedDayNames[(3+weekstart)%7], dtf.AbbreviatedDayNames[(4+weekstart)%7], dtf.AbbreviatedDayNames[(5+weekstart)%7], dtf.AbbreviatedDayNames[(6+weekstart)%7], cssDayHdr);var weekNr = weekNumber( date);var startDay = (date.getDay() - weekstart) % 7;if ( startDay < 0) startDay = 7 + startDay;var day = 1;var row = String.format( '<tr align="center" class="{2}"><td class="{0}">{1}</td>', cssDayHdr, weekNr, cssDay);for( var i = 0;i < 7;i++)
{
if ( startDay <= i)
{
row += formatDayCell( date, selDate, cssDay, day, calDaySelected, calToday, tag);day += 1;}
else
{
row += "<td>&nbsp;</td>";}
}
html += row + "</tr>";weekNr += 1;if ( weekNr > 52) weekNr = 1;for ( var j = 0;j < 3;j++)
{
row = String.format( '<tr align="center" class="{2}"><td class="{0}">{1}</td>', cssDayHdr, weekNr, cssDay);for( var i = 0;i < 7;i++)
{
row += formatDayCell( date, selDate, cssDay, day, calDaySelected, calToday, tag);day += 1;}
html += row + "</tr>";weekNr += 1;}
var lastDay = lastDate.getDate();for( j = 0;j < 2;j++)
{
if ( day <= lastDay)
{
row = String.format( '<tr align="center" class="{2}"><td class="{0}">{1}</td>', cssDayHdr, weekNr, cssDay);for( var i = 0;i < 7;i++)
{
if ( day <= lastDay)
{
row += formatDayCell( date, selDate, cssDay, day, calDaySelected, calToday, tag);day += 1;}
else
{
row += "<td>&nbsp;</td>";}
}
html += row + "</tr>";weekNr += 1;}
}
html += '</table>';return html;}
function formatDayCell( firstDate, selDate, cssDay, day, calDaySelected, calToday, tag)
{
var cellDate = new Date( Date.UTC(firstDate.getFullYear(), firstDate.getMonth(), day));var item = calItems[ tag + cellDate];var css = cssDay;var today = new Date();today = new Date( Date.UTC( today.getFullYear(), today.getMonth(), today.getDate()));if ( cellDate.getFullYear() == today.getFullYear() 
&& cellDate.getMonth() == today.getMonth() 
&& cellDate.getDate() == today.getDate() )
css = calToday;if ( cellDate.getFullYear() == selDate.getFullYear() 
&& cellDate.getMonth() == selDate.getMonth() 
&& cellDate.getDate() == selDate.getDate() )
css = calDaySelected;if ( item != null)
return String.format( "<td class='{0}'><a href='{2}' title='{3}' class='{0}'>{1}</a></td>", css, day, item.Url, item.Tooltip);else
return String.format( "<td class='{0}'>{1}</td>", css, day);}
function weekNumber( time)
{
return GetWeekOfYearFullDays(time, 1, 4);}
function GetDayOfYear( time)
{
var start = new Date(time.getFullYear(), 0, 1);return (time.valueOf() - start.valueOf()) / 86400000 + 1;}
function GetDaysInYear( year)
{
if (((year % 4) == 0) && (((year % 100) != 0) || ((year % 400) == 0)))
{
return 366;}
return 365;}
function GetWeekOfYearFullDays( time, firstDayOfWeek, fullDays )
{
var num4 = GetDayOfYear(time) - 1;var num1 = time.getDay() - (num4 % 7);var num2 = ((firstDayOfWeek - num1) + 14) % 7;if ((num2 != 0) && (num2 >= fullDays))
{
num2 -= 7;}
var num3 = num4 - num2;if (num3 < 0)
{
var num5 = time.getFullYear();num4 = GetDaysInYear(num5 - 1);num1 -= num4 % 7;num2 = ((firstDayOfWeek - num1) + 14) % 7;if ((num2 != 0) && (num2 >= fullDays))
{
num2 -= 7;}
num3 = num4 - num2;}
return parseInt("" + ((num3 / 7) + 1));}
this.OnCompleteCS = function( result, userContext) 
{
calItemsFetched[ userContext.Tag + userContext.Date] = true;for( var i = 0;i < result.length;i++)
{ 
calItems[userContext.Tag + result[i].Date] = result[i];}
userContext.Func();};this.OnErrorCS = function ( result, userContext) 
{
alert( "Oops failed. Try it again...");};}
document.clc = new CalController();function Albums()
{
var albums = null;this.loadAlbums = function(a,oc,oe)
{
if ( albums == null)
{
EditPopupService1.GetUserAlbums( a,
function( result) 
{
albums = result;oc(result);},
oe);}
else
{
oc(albums);}
}
var images = new Array();this.loadImages = function(a,album,oc,oe)
{
if ( images[album] == null)
{
EditPopupService1.GetUserImages( album, a,
function( result) 
{
images[album] = result;oc(result);},
oe);}
else
{
oc(images[album]);}
}
}
document.albms = new Albums();function PopupHelper()
{
this.loadItems = function(sid, lf)
{
$get(sid).innerHTML = "<div style='width:100%; height:100%;'><span class='img_nbdr' style='width:100%; height:100%;'>&nbsp;&nbsp;&nbsp;</span></div>";lf();},
this.errorLoadItems = function(sid)
{
$get(sid).innerHTML = "<div style='width:100%; height:100%;'><span style='width:100%; height:100%;'>Oops, that didnt work...</span></div>";},
this.setupSelect = function(id, from, to, step, selected)
{
var select = $get(id);var idx = 0;for( var i = from;i <= to;i += step)
{
select.options[idx+1] = new Option(i,i);if ( i == selected)
select.selectedIndex = idx+1;idx++;}
},
this.selectImage = function( btn, select, pf, p)
{
var container = $get(select ? pf + '_selected' : pf + '_selectables');container.appendChild( btn._image.ui);btn.onclick = function() { document.pphlpr.selectImage(this,select == 1 ? 0 : 1, pf, p);};if ( btn._image._txtCont)
btn._image._txtCont.style.display = select == 1 ? '' : 'none';btn._image._butCont.style.display = select == 1 ? '' : 'none';btn._image._butCont2.style.display = select == 1 ? '' : 'none';p.updatePreview();}
this.moveImage = function( btn, moveUp, p)
{
var sib = moveUp == 1 ? btn._image.ui.previousSibling : btn._image.ui.nextSibling;if ( !sib) return;var container = btn._image.ui.parentNode;if ( moveUp)
container.insertBefore( btn._image.ui, sib);else
container.insertBefore( sib, btn._image.ui);p.updatePreview();},
this.createItemUI = function(e,pf,p,o,i,d,t)
{
var item = document.createElement('DIV');var img = document.createElement('IMG');img.src = 'http://images.pp2g.com/m' + i + '.aspx';if ( d)
{
img.alt = d;img.title = d;}
img.width = 45;img.height = 45;img._image = o;img.onclick = function() { document.pphlpr.selectImage(this,1,pf,p);} ;img.className = 'img';img.style.borderWidth = '0px';img.style.cursor = 'pointer';var ubtn = document.createElement('INPUT');ubtn.type = 'BUTTON';ubtn.value = '<';ubtn._image = o;ubtn.onclick = function() { document.pphlpr.moveImage(this,1,p);};ubtn.style.height = '45px';ubtn.style.width = '15px';var butCont = document.createElement('DIV');butCont.style.cssFloat = 'left';butCont.style.styleFloat = 'left';butCont.appendChild( ubtn);item.appendChild( butCont);o._butCont = butCont;var imgCont = document.createElement('DIV');imgCont.style.textAlign = 'center';imgCont.style.cssFloat = 'left';imgCont.style.styleFloat = 'left';item.appendChild( imgCont);imgCont.appendChild( img);var dbtn = document.createElement('INPUT');dbtn.type = 'BUTTON';dbtn.value = '>';dbtn._image = o;dbtn.onclick = function() { document.pphlpr.moveImage(this,0,p);};dbtn.style.height = '45px';dbtn.style.width = '15px';var butCont2 = document.createElement('DIV');item.appendChild( butCont2);butCont2.appendChild( dbtn);o._butCont2 = butCont2;if ( t)
{
var txt = document.createElement('INPUT');txt.value = t;txt.onchange = function() { this._image.d = this.value;p.updatePreview();} ;txt._image = o;txt.style.width = '72px';var txtCont = document.createElement('DIV');txtCont.style.textAlign = 'center';txtCont.style.width = '1px';txtCont.appendChild( txt);item.appendChild( txtCont);o._txtCont = txtCont;txtCont.style.display = 'none';}
var sur = document.createElement('DIV');sur.style.margin = '2px';sur.appendChild( item);e.appendChild( sur);sur._image = item._image = o;o.ui = sur;sur.style.cssFloat = 'left';sur.style.styleFloat = 'left';butCont.style.display = 'none';butCont2.style.display = 'none';}
}
document.pphlpr = new PopupHelper();function RotatorPopup()
{
this.GetUIHtml = function()
{
return '<table><tr><td><b>BESCHIKBAAR</b>&nbsp;<select id="irp_sel_alb" onchange="document.irp.loadImages();"></select><div id="irp_selectables" style="background-color: #ffffff; border: solid 1px black; overflow:auto; height: 125px; width: 430px; float:left;"></div></td><td valign="top" rowspan="2"><b>OPTIES</b><div id="irp_options"><table><tr id="tr_option_w"><td>Breedte:</td><td><select id="option_w" onchange="document.irp.updatePreview();"></select></td></tr><tr id="tr_option_h"><td>Hoogte:</td><td><select id="option_h" onchange="document.irp.updatePreview();"></select></td></tr><tr><td colspan="2">&nbsp;</td></tr><tr><td>Overgangstijd:</td><td><select id="option_rotatetime" onchange="document.irp.updatePreview();"></select></td></tr><tr><td>Overgang:</td><td><select id="option_transition" onchange="document.irp.updatePreview();"><option value="random">Willekeurig</option><option value="circles">Cirkels</option><option value="bubbles">Bubbels</option><option value="lines">Lijnen</option><option value="blocks">Blokken</option><option value="fluids">Vloed</option><option value="fade">Geleidelijk</option><option value="bgfade">Geleidelijk 2</option><option value="slowfade">Geleidelijk 3</option><option value="flash">Flitsen</option><option value="slide">Schuiven</option><option value="push">Duwen</option></select></td></tr><tr id="tr_option_str"><td>Stretch:</td><td><select id="option_overstretch" onchange="document.irp.updatePreview();"><option value="true">Ja</option><option value="fit">Passend</option><option value="false">Nee</option><option value="none">Origineel</option></select></td></tr><tr><td>Op volgorde:</td><td><select id="option_shuffle" onchange="document.irp.updatePreview();" ><option value="false">Ja</option><option value="true">Nee</option></select></td></tr><tr><td colspan="2">&nbsp;</td></tr><tr id="tr_option_fc"><td>Forecolor:</td><td><select id="option_frontcolor" onchange="document.irp.updatePreview();" ></select></td></tr><tr id="tr_option_bc"><td>Backcolor:</td><td><select id="option_backcolor" onchange="document.irp.updatePreview();" ></select></td></tr><tr id="tr_option_hc"><td>Hilightcolor:</td><td><select id="option_lightcolor" onchange="document.irp.updatePreview();" ></select></td></tr><tr><td colspan="2">&nbsp;</td></tr><tr id="tr_option_nav"><td>Toon&nbsp;navigatie:</td><td><select id="option_shownavigation" onchange="document.irp.updatePreview();" ><option value="true">Ja</option><option value="false">Nee</option></select></td></tr><tr><td colspan="2">&nbsp;</td></tr><tr><td align="right"><a class="button" href="javascript://" onclick="document.irp.clickOK();">OK</a></td><td><a class="button" href="javascript://" onclick="document.irp.clickCancel();">CANCEL</a></td></tr></table></div></td></tr><tr><td><b>GESELECTEERD</b><div id="irp_selected" style="background-color: #ffffff; border: solid 1px black; overflow:auto; height: 125px; width: 430px"></div></td></tr><tr><td colspan="2" align="center"><b>VOORBEELD</b><div style="background-color: #ffffff; border: solid 1px black; text-align: center;"><div id="irp_preview" style="margin : 2px;"></div></div></td></tr></table>';}
this.loadAlbums = function()
{
document.pphlpr.loadItems('irp_selectables', function()
{
document.albms.loadAlbums( avatarMode==1,
function(albums)
{
setupSelectAlbums(albums);$get('irp_selectables').innerHTML = "";document.irp.loadImages();},
function() { document.pphlpr.errorLoadItems('irp_selectables');});});}
this.loadImages = function()
{
$get('irp_selectables').innerHTML = "<div style='width:100%; height:100%;'><span class='img_nbdr' style='width:100%; height:100%;'>&nbsp;&nbsp;&nbsp;</span></div>";var sel_alb = $get('irp_sel_alb');if ( sel_alb.selectedIndex != -1)
{
document.albms.loadImages( avatarMode==1, sel_alb.options[sel_alb.selectedIndex].value, 
function(images)
{
$get('irp_selectables').innerHTML = "";document.irp.buildChoices(images);},
function()
{
$get('irp_selectables').innerHTML = "<div style='width:100%; height:100%;'><span style='width:100%; height:100%;'>Oops, that didnt work...</span></div>"
});}
else
{
$get('irp_selectables').innerHTML = "<div style='width:100%; height:100%;'><span style='width:100%; height:100%;'>Oops, that didnt work...</span></div>";}
}
this.buildChoices = function(images)
{
var editor = $get('irp_selectables');if ( images.length == 0)
{
editor.innerHTML = 'Je hebt nog geen private pictures. Load eerst een aantal private pictures op.';}
else
{
var selectedPhotos = $get('irp_selected').childNodes;for( var i = 0;i < images.length;i++)
{
var cont = false;for ( var j= 0;j < selectedPhotos.length;j++)
{
if ( selectedPhotos[j]._image && selectedPhotos[j]._image.t == images[i].t)
{
cont = true;break;}
}
if (cont)
continue;document.pphlpr.createItemUI(editor,'irp',this,images[i],images[i].t,null,images[i].d);}
if ( avatarMode == 1)
{
document.pphlpr.setupSelect( 'option_w', 80, 80, 10, 80);document.pphlpr.setupSelect( 'option_h', 80, 80, 10, 80);$get('tr_option_w').style.display = 'none';$get('tr_option_h').style.display = 'none';$get('tr_option_fc').style.display = 'none';$get('tr_option_bc').style.display = 'none';$get('tr_option_hc').style.display = 'none';$get('tr_option_nav').style.display = 'none';$get('tr_option_str').style.display = 'none';$get('option_shownavigation').selectedIndex = 1;}
else
{
document.pphlpr.setupSelect( 'option_w', 60, 640, 10, 320);document.pphlpr.setupSelect( 'option_h', 60, 640, 10, 240);}
document.pphlpr.setupSelect( 'option_rotatetime', 5, 10, 1, 5);setupSelectColor( 'option_frontcolor', '0xFFFFFF');setupSelectColor( 'option_backcolor', '0xFFFFFF');setupSelectColor( 'option_lightcolor', '0xFFFFFF');this.updatePreview();}
}
function setupSelectAlbums(albums)
{
var select = $get('irp_sel_alb');var idx = 0;for( var i = 0;i < albums.length;i++)
{
select.options[idx] = new Option(albums[i].d,albums[i].i);idx++;}
}
function setupSelectColor(id, selected)
{
var select = $get(id);var colors = document.parserMan.get_colors();for( var i = 0;i < colors.length;i++)
{
var opt = new Option(colors[i].n,colors[i].c);select.options[i] = opt;opt.style.backgroundColor = colors[i].n;if ( colors[i].c == selected)
select.selectedIndex = i;}
}
function getOptionsRecursive(node)
{
var items = node.childNodes;var options = '';for ( var i = 0;i < items.length;i++)
{
var item = items[i];if ( item.id && item.id.match('^option_'))
{
options += item.id.substring(7) + '=' + item.options[item.selectedIndex].value + '&';}
else
options += getOptionsRecursive(item);}
return options;}
this.updatePreview = function()
{
$get('irp_preview').innerHTML = document.parserMan.ParseUBB( '[rotator]'+getOptions()+'[/rotator]',0,1);}
function escapeDescription( d)
{
var r = ['&','\\(','\\)','\\|',':','@','#'];var e = ['&','(',')','|',':','@','#'];for( var i = 0;i < r.length;i++)
{
var reg = new RegExp( r[i], 'ig');d = d.replace( reg, escape(e[i]));delete reg;}
return d;}
function getOptions()
{
var options = getOptionsRecursive( $get('irp_options'));var photos = '';var items = $get('irp_selected').childNodes;for ( var i = 0;i < items.length;i++)
{
if ( items[i]._image)
{
photos += escapeDescription( items[i]._image.d) + '@@@@' + items[i]._image.i + '##';}
}
if ( photos.length > 0)
photos = photos.substring(0, photos.length - 2);return options + 'items=' + photos;}
this.clickOK = function()
{
if ( avatarMode == 1)
{
var txt = '[rotator]' + getOptions() + '&overalllink=/members/' + _u + '.aspx[/rotator]';$get(_fldh).value = txt;$get(_fld).innerHTML = document.parserMan.ParseUBB( txt,0,1);$find('editorMan').hideFlashEditor( 'rotator','');avatarMode = 0;}
else
{
$find('editorMan').hideFlashEditor( 'rotator',getOptions());}
}
this.clickCancel = function()
{
$find('editorMan').hideFlashEditor( 'rotator','');avatarMode = 0;}
var avatarMode = 0;var _fldh;var _fld;var _u;this.ShowEditAvatar = function(ctrl,fldh,fld,u)
{
avatarMode = 1;_fldh = fldh;_fld = fld;_u = u;$find('editorMan').showFlash(ctrl,'rotatorEditor',-200);}
}
document.irp = new RotatorPopup();function ImageSelectPopup()
{
this.GetUIHtml = function()
{
return '<table><tr><td><b>BESCHIKBAAR</b>&nbsp;<select id="isp_sel_alb" onchange="document.isp.loadImages();"></select><div id="isp_selectables" style="background-color: #ffffff; border: solid 1px black; overflow:auto; height: 125px; width: 430px; float:left;"></div></td><td valign="top" rowspan="2"><b>OPTIES</b><div id="isp_options"><table><tr id="tr_option_w"><td>Breedte:</td><td><select id="option_w" onchange="document.isp.updatePreview();"></select></td></tr><tr id="tr_option_h"><td>Hoogte:</td><td><select id="option_h" onchange="document.isp.updatePreview();"></select></td></tr><tr><td align="right"><a class="button" href="javascript://" onclick="document.isp.clickOK();">OK</a></td><td><a class="button" href="javascript://" onclick="document.isp.clickCancel();">CANCEL</a></td></tr></table></div></td></tr><tr><td><b>GESELECTEERD</b><div id="isp_selected" style="background-color: #ffffff; border: solid 1px black; overflow:auto; height: 125px; width: 430px"></div></td></tr><tr><td colspan="2" align="center"><b>VOORBEELD</b><div style="background-color: #ffffff; border: solid 1px black; text-align: center;"><div id="isp_preview" style="margin : 2px;"></div></div></td></tr></table>';}
this.loadAlbums = function()
{
document.pphlpr.loadItems('isp_selectables', function()
{
document.albms.loadAlbums( false,
function(albums)
{
setupSelectAlbums(albums);$get('isp_selectables').innerHTML = "";document.isp.loadImages();},
function() { document.pphlpr.errorLoadItems('isp_selectables');});});}
var images = null;this.loadImages = function()
{
$get('isp_selectables').innerHTML = "<div style='width:100%; height:100%;'><span class='img_nbdr' style='width:100%; height:100%;'>&nbsp;&nbsp;&nbsp;</span></div>";var sel_alb = $get('isp_sel_alb');if ( sel_alb.selectedIndex != -1)
{
document.albms.loadImages( false, sel_alb.options[sel_alb.selectedIndex].value, 
function(images)
{
$get('isp_selectables').innerHTML = "";document.isp.buildChoices(images);},
function()
{
$get('isp_selectables').innerHTML = "<div style='width:100%; height:100%;'><span style='width:100%; height:100%;'>Oops, that didnt work...</span></div>"
});}
else
{
$get('isp_selectables').innerHTML = "<div style='width:100%; height:100%;'><span style='width:100%; height:100%;'>Oops, that didnt work...</span></div>";}
}
this.buildChoices = function(images)
{
var editor = $get('isp_selectables');if ( images.length == 0)
{
editor.innerHTML = 'Je hebt nog geen private pictures. Load eerst een aantal private pictures op.';}
else
{
var selectedPhotos = $get('isp_selected').childNodes;for( var i = 0;i < images.length;i++)
{
var cont = false;for ( var j= 0;j < selectedPhotos.length;j++)
{
if ( selectedPhotos[j]._image && selectedPhotos[j]._image.t == images[i].t)
{
cont = true;break;}
}
if (cont)
continue;document.pphlpr.createItemUI(editor,'isp',this,images[i],images[i].t,images[i].d);}
$get('option_w').options[0] = new Option('Original','');$get('option_h').options[0] = new Option('Original','');document.pphlpr.setupSelect( 'option_w', 60, 640, 10, 0);document.pphlpr.setupSelect( 'option_h', 60, 640, 10, 0);this.updatePreview();}
}
function setupSelectAlbums(albums)
{
var select = $get('isp_sel_alb');var idx = 0;for( var i = 0;i < albums.length;i++)
{
select.options[idx] = new Option(albums[i].d,albums[i].i);idx++;}
}
this.updatePreview = function()
{
$get('isp_preview').innerHTML = document.parserMan.ParseUBB( getOptions(),0,1);}
function getOptions()
{
var options = '';var w = $get('option_w').options[$get('option_w').selectedIndex].value;var h = $get('option_h').options[$get('option_h').selectedIndex].value;var d = (w == '' || h == '') ? '' : '=' + w + ',' + h;var items = $get('isp_selected').childNodes;for ( var i = 0;i < items.length;i++)
{
if ( items[i]._image)
options += '[img' + d + ']http://images.pp2g.com/m' + items[i]._image.i + '.aspx[/img]';}
return options;}
this.clickOK = function()
{
$find('editorMan').hideFlashEditor( 'selectImage',getOptions());}
this.clickCancel = function()
{
$find('editorMan').hideFlashEditor( 'selectImage','');}
}
document.isp = new ImageSelectPopup();function TagVideoPopup()
{
this.GetUIHtml = function()
{
return '<table><tr><td><b>' + userLanguage("Search Video Tags:", "Zoek op Video Tags:") + '</b>&nbsp;<input type="text" id="tvp_sel_alb" onchange="document.tvp.loadVideos();">&nbsp;<a class="button" href="javascript://" onclick="document.tvp.loadVideos();return false;" >' + userLanguage("SEARCH", "ZOEK") + '</a><div id="tvp_selectables" style="background-color: #ffffff; border: solid 1px black; overflow:auto; height: 125px; width: 430px; float:left;"></div></td><td valign="top" rowspan="2"><b>OPTIES</b><div id="tvp_options"><table><tr id="tr_option_w"><td>Breedte:</td><td><select id="option_w" onchange="document.tvp.updatePreview();"></select></td></tr><tr id="tr_option_h"><td>Hoogte:</td><td><select id="option_h" onchange="document.tvp.updatePreview();"></select></td></tr><tr><td align="right"><a class="button" href="javascript://" onclick="document.tvp.clickOK();">OK</a></td><td><a class="button" href="javascript://" onclick="document.tvp.clickCancel();">CANCEL</a></td></tr></table></div></td></tr><tr><td><b>GESELECTEERD</b><div id="tvp_selected" style="background-color: #ffffff; border: solid 1px black; overflow:auto; height: 125px; width: 430px"></div></td></tr><tr><td colspan="2" align="center"><b>VOORBEELD</b><div style="background-color: #ffffff; border: solid 1px black; text-align: center;"><div id="tvp_preview" style="margin : 2px;"></div></div></td></tr></table>';}
this.loadVideos = function()
{
document.pphlpr.loadItems('tvp_selectables', function()
{
EditPopupService1.GetTagVideos( $get('tvp_sel_alb').value, 
function(videos)
{
$get('tvp_selectables').innerHTML = "";document.tvp.buildChoices(videos);},
function() { document.pphlpr.errorLoadItems('tvp_selectables');});});}
this.buildChoices = function(videos)
{
var editor = $get('tvp_selectables');if ( videos == null || videos.length == 0)
{
editor.innerHTML = userLanguage("No videos found.", "Geen video's gevonden.");}
else
{
var selectedVideos = $get('tvp_selected').childNodes;for( var i = 0;i < videos.length;i++)
{
var cont = false;for ( var j= 0;j < selectedVideos.length;j++)
{
if ( selectedVideos[j]._v && videos[i].v)
{
cont = true;break;}
}
if (cont)
continue;document.pphlpr.createItemUI(editor,'tvp',this,videos[i],videos[i].i,videos[i].d);}
$get('option_w').options[0] = new Option('Original','');$get('option_h').options[0] = new Option('Original','');document.pphlpr.setupSelect( 'option_w', 150, 640, 10, 0);document.pphlpr.setupSelect( 'option_h', 150, 640, 10, 0);this.updatePreview();}
}
this.updatePreview = function()
{
$get('tvp_preview').innerHTML = document.parserMan.ParseUBB( getOptions(),0,1);}
function getOptions()
{
var options = '';var w = $get('option_w').options[$get('option_w').selectedIndex].value;var h = $get('option_h').options[$get('option_h').selectedIndex].value;var d = (w == '' || h == '') ? '' : ' w=' + w + ' h=' + h;var items = $get('tvp_selected').childNodes;for ( var i = 0;i < items.length;i++)
{
if ( items[i]._image)
options += '[pp2gtv' + d + ']' + items[i]._image.v + '[/pp2gtv]';}
return options;}
this.clickOK = function()
{
$find('editorMan').hideFlashEditor( 'tagVideo',getOptions());}
this.clickCancel = function()
{
$find('editorMan').hideFlashEditor( 'tagVideo','');}
}
document.tvp = new TagVideoPopup();
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();