
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
var version;
var axo;
var e;
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
version = axo.GetVariable("$version");
} catch (e) {
}
if (!version)
{
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
version = "WIN 6,0,21,0";
axo.AllowScriptAccess = "always";
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = "WIN 3,0,18,0";
} catch (e) {
}
}
if (!version)
{
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
version = "WIN 2,0,0,11";
} catch (e) {
version = -1;
}
}
return version;
}
function GetSwfVer(){
var flashVer = -1;
if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
var descArray = flashDescription.split(" ");
var tempArrayMajor = descArray[2].split(".");
var versionMajor = tempArrayMajor[0];
var versionMinor = tempArrayMajor[1];
var versionRevision = descArray[3];
if (versionRevision == "") {
versionRevision = descArray[4];
}
if (versionRevision[0] == "d") {
versionRevision = versionRevision.substring(1);
} else if (versionRevision[0] == "r") {
versionRevision = versionRevision.substring(1);
if (versionRevision.indexOf("d") > 0) {
versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
}
}
var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
}
}
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
else if ( isIE && isWin && !isOpera ) {
flashVer = ControlVersion();
}
return flashVer;
}
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
versionStr = GetSwfVer();
if (versionStr == -1 ) {
return false;
} else if (versionStr != 0) {
if(isIE && isWin && !isOpera) {
tempArray         = versionStr.split(" "); // ["WIN", "2,0,0,11"]
tempString        = tempArray[1];// "2,0,0,11"
versionArray      = tempString.split(",");// ['2', '0', '0', '11']
} else {
versionArray      = versionStr.split(".");
}
var versionMajor      = versionArray[0];
var versionMinor      = versionArray[1];
var versionRevision   = versionArray[2];
if (versionMajor > parseFloat(reqMajorVer)) {
return true;
} else if (versionMajor == parseFloat(reqMajorVer)) {
if (versionMinor > parseFloat(reqMinorVer))
return true;
else if (versionMinor == parseFloat(reqMinorVer)) {
if (versionRevision >= parseFloat(reqRevision))
return true;
}
}
return false;
}
}
function AC_AddExtension(src, ext)
{
if (src.indexOf('?') != -1)
return src.replace(/\?/, ext+'?');
else
return src + ext;
}
function AC_Generateobj(objAttrs, params, embedAttrs)
{
var str = '';
if (isIE && isWin && !isOpera)
{
str += '<object ';
for (var i in objAttrs)
{
str += i + '="' + objAttrs[i] + '" ';
}
str += '>';
for (var i in params)
{
str += '<param name="' + i + '" value="' + params[i] + '" /> ';
}
str += '</object>';
}
else
{
str += '<embed ';
for (var i in embedAttrs)
{
str += i + '="' + embedAttrs[i] + '" ';
}
str += '> </embed>';
}
document.write(str);
}
function AC_FL_RunContent(){
var ret =
AC_GetArgs
(  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
, "application/x-shockwave-flash"
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_SW_RunContent(){
var ret =
AC_GetArgs
(  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
, null
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
var ret = new Object();
ret.embedAttrs = new Object();
ret.params = new Object();
ret.objAttrs = new Object();
for (var i=0; i < args.length; i=i+2){
var currArg = args[i].toLowerCase();
switch (currArg){
case "classid":
break;
case "pluginspage":
ret.embedAttrs[args[i]] = args[i+1];
break;
case "src":
case "movie":
args[i+1] = AC_AddExtension(args[i+1], ext);
ret.embedAttrs["src"] = args[i+1];
ret.params[srcParamName] = args[i+1];
break;
case "onafterupdate":
case "onbeforeupdate":
case "onblur":
case "oncellchange":
case "onclick":
case "ondblclick":
case "ondrag":
case "ondragend":
case "ondragenter":
case "ondragleave":
case "ondragover":
case "ondrop":
case "onfinish":
case "onfocus":
case "onhelp":
case "onmousedown":
case "onmouseup":
case "onmouseover":
case "onmousemove":
case "onmouseout":
case "onkeypress":
case "onkeydown":
case "onkeyup":
case "onload":
case "onlosecapture":
case "onpropertychange":
case "onreadystatechange":
case "onrowsdelete":
case "onrowenter":
case "onrowexit":
case "onrowsinserted":
case "onstart":
case "onscroll":
case "onbeforeeditfocus":
case "onactivate":
case "onbeforedeactivate":
case "ondeactivate":
case "type":
case "codebase":
case "id":
ret.objAttrs[args[i]] = args[i+1];
break;
case "width":
case "height":
case "align":
case "vspace":
case "hspace":
case "class":
case "title":
case "accesskey":
case "name":
case "tabindex":
ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
break;
default:
ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
}
}
ret.objAttrs["classid"] = classid;
if (mimeType) ret.embedAttrs["type"] = mimeType;
return ret;
}

var requiredMajorVersion = 8;
var requiredMinorVersion = 0;
var requiredRevision = 0;
var imagePath = 'http://cdn.cultureunplugged.com/assets/images';
var serverURL = 'http://www.cultureunplugged.com';
var W3CDOM = (document.createElement && document.getElementsByTagName);
var isMac = navigator.userAgent.indexOf('Mac') != -1;
var isIE =  navigator.appName.indexOf("Microsoft") != -1;
var isIE6 = 0;
var isIE7 = 0;
if(isIE) {
var temp=navigator.appVersion.split('MSIE');
var ieVer=parseInt(temp[1]);
isIE6=(ieVer == 6)?1:0;
isIE7=(ieVer == 7)?1:0;
}
var isFirefox = navigator.userAgent.indexOf('Firefox') !=-1;
var isSafari = navigator.userAgent.indexOf('Safari') !=-1;
function $j(id){ return document.getElementById(id); }
function $style(id){ return document.getElementById(id).style;}
function trim(str){ return str.replace(/^\s+|\s+$/g,"");}
function json_decode(JSONtext){ return eval('(' + JSONtext + ')');}
function reloadImage(img){ if(img) { img.src = img.src + ((img.src.search(/\?/)!=-1)?'&':'?') + (new Date()).getTime(); }}
function getFlashMovie(movieName) { return (isIE) ? window[movieName] : document[movieName]; }
function getServerURL() { /*var url = window.location.toString(); return url.substring(0, url.indexOf('/',7));*/ return serverURL;}
function reLoadPage() { hideAllPopUps(); window.location.reload();}
function rollOverImage(div) { if(div.src.indexOf('_rollover')==-1) { div.src = div.src.replace(/(.+)\.(\w+)$/,'$1_rollover.$2'); }}
function normalImage(div) { div.src = div.src.replace('_rollover',''); }
function rollOverInnerImage(obj){ var imgs = obj.getElementsByTagName('img'); for(var i=0;i<imgs.length;i++) if(imgs[i]) rollOverImage(imgs[i]);}
function normalInnerImage(obj){var imgs = obj.getElementsByTagName('img');for(var i=0;i<imgs.length;i++) {
try { if(imgs[i]) normalImage(imgs[i]) } catch(e){};
} }
function disableRightClick() { document.body.oncontextmenu = function() { return false; }; }
function URLEncode (clearString) { var output = ''; var x = 0; clearString = clearString.toString();var regex = /(^[a-zA-Z0-9_.]*)/;
while (x < clearString.length) { var match = regex.exec(clearString.substr(x)); if (match != null && match.length > 1 && match[1] != '') { output += match[1];x += match[1].length;}
else { if (clearString[x] == ' ') output += '+'; else { var charCode = clearString.charCodeAt(x);var hexVal = charCode.toString(16);output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();} x++;}
} return output;
}
function URLDecode (encodedString) { var output = encodedString; var binVal, thisString; var myregexp = /(%[^%]{2})/;
while ((match = myregexp.exec(output)) != null && match.length > 1 && match[1] != '') {
binVal = parseInt(match[1].substr(1),16); thisString = String.fromCharCode(binVal); output = output.replace(match[1], thisString);
} return output;
}
function checkFlashVersion(){
return;
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if(!hasReqestedVersion){ window.location = '/systemRequirement.php'; }
}
function mouseOverClass(div) { if(div.className.indexOf('_rollover')==-1) { div.className = div.className+'_rollover'; } }
function mouseOutClass(div) { div.className = div.className.replace('_rollover',''); }
function getPageOffset() {
var x,y; if (self.pageYOffset){ x = self.pageXOffset; y = self.pageYOffset;}
else if (document.documentElement && document.documentElement.scrollTop) // Explorer 6 Strict
{ x = document.documentElement.scrollLeft;y = document.documentElement.scrollTop;}
else if (document.body) // all other Explorers
{ x = document.body.scrollLeft;y = document.body.scrollTop; }
return { 'x':x, 'y':y };
}
function getDivHeight(id) {
var h = 0;
var o = $j(id).firstChild;
while(o.nextSibling) {
o = o.nextSibling;
if(o.nodeName.toLowerCase()=='div') {
h += o.offsetHeight;
}
}
return h;
}
function getBrowserSize(){
var w = 0, h = 0;
if( typeof( window.innerWidth ) == 'number' ) {
w = window.innerWidth; h = window.innerHeight;}
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
w = document.documentElement.clientWidth;h = document.documentElement.clientHeight;}
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
w = document.body.clientWidth; h = document.body.clientHeight; }
return {'w': w, 'h':h}
}
function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
obj = obj.offsetParent;
} while (obj.offsetParent);
}
return {x:curleft, y:curtop};
}
function getDocHeight() {
var D = document;
return Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
Math.max(D.body.clientHeight, D.documentElement.clientHeight)
);
}
function getEvent(windowEvent) {
if(typeof(windowEvent.keycode) != 'undefined') { return windowEvent; }
if(window.event) { windowEvent = window.event; windowEvent.keycode = windowEvent.keyCode;}
else { windowEvent.keycode = windowEvent.which;}
switch(windowEvent.keycode){
case 9: windowEvent.key = '\t'; break;
case 8:windowEvent.key = '[\b]'; break;
case 13: windowEvent.key = '\n'; break;
default: windowEvent.key = String.fromCharCode(windowEvent.keycode);
} return windowEvent;
}
function addListener(element, type, expression, bubbling){
bubbling = bubbling || false;
if(window.addEventListener) { // Standard
element.addEventListener(type, expression, bubbling); return true;
} else if(window.attachEvent) { // IE
element.attachEvent('on' + type, expression); return true;
} else return false;
}
function isEnterKey(e) { var e = getEvent(e); return e.keycode==13; }
function isBackspaceKey(e) { var e = getEvent(e); return e.keycode == 8;}
function isTabKey(e) { var e = getEvent(e); return e.keycode == 9;}
function isAlphaNumeric(e){ var e = getEvent(e); return /([0-9a-zA-Z]|[\b])/.test(e.key);}
function isLetter(e){  var e = getEvent(e); return /([a-zA-Z'])/.test(e.key);}
function isValidEmail(email) { email = email.toLowerCase(); return /^([a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|cat|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)(,|;)?)+$/.test(email);}
function hasValidEmail(email) {email = email.toLowerCase(); return /([a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|cat|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)(,|;)?)+/.test(email);}
function isNumber(e){ var e = getEvent(e); return /([0-9]|[\b])/.test(e.key);}
function isSpace(e){ var e = getEvent(e); return /\s/.test(e.key);}
function isSystemKeys(e) { var e = getEvent(e); return e.keycode==0;}
function isAllowedKeys(e, allowSpace){ return (allowSpace==1 && isSpace(e)) ? true : isBackspaceKey(e) || isSystemKeys(e) ; }
function hasHyperLink(text) { text = text.toLowerCase(); return /((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&amp;]*)?)?(#[a-z][a-z0-9_]*)?/.test(text);}
function isAmpersand(e) { var e = getEvent(e); return /([&])/.test(e.key); }
function isComma(e) { var e = getEvent(e); return /([,])/.test(e.key); }
function getNumEmails(str) { var match = str.match(/@/g); return match.length; }
function isPrice(e) {var e = getEvent(e); return /([0-9.]|[\b])/.test(e.key);}
function updatePrice(elm) { var res = /^\d+(\.)?(\d+)?$/.test(elm.value); if(!res) { var p = parseFloat(elm.value); if(isNaN(p)) { elm.value='';} else { elm.value = p; } } }
function verifyPrice(elm) { elm.value=elm.value.replace(/[^0-9.]/,''); var num = parseFloat(elm.value); if(isNaN(num)) {num=0;} elm.value='$'+num; }
function initPrice(elm) { elm.value=elm.value.replace(/[^0-9.]/,''); }
function setPageBlockerHeight() {
var footerHeight = $j('filmsOn') ? $j('filmsOn').offsetHeight : 0;
var h = $j('section_1')
? /*$j('section_1').offsetHeight + */$j('section_2').offsetHeight+footerHeight
: $j('wrapper').offsetHeight;
$style('pageBlocker').height = h + 'px';
}
function showPageBlocker(){
if(typeof($style('pageBlocker').height == 'undefined')) {setPageBlockerHeight(); }
hideAllFlashPlayers();$style('pageBlocker').display = 'block';
}
function hidePageBlocker() {
$style('pageBlocker').display = 'none';showAllFlashPlayers();
}
function showPopUpPageBlocker(){
var h = getDocHeight();
if(!$j('_popUpPageBlocker')){
var div = document.createElement('div');
div.id = '_popUpPageBlocker';
with(div.style) {
position = 'absolute';
top = '0px';
left = '0px';
backgroundColor = '#000000';
display = 'none';
zIndex = 1000;
}
document.body.appendChild(div);
div.style.width = '100%';
div.style.height = h + 'px';
}
$style('_popUpPageBlocker').display = 'block';
$style('_popUpPageBlocker').filter = 'alpha(opacity=60)';
$style('_popUpPageBlocker').MsFilter = "progid:DXImageTransform.Microsoft.Alpha(opacity=60)";
$style('_popUpPageBlocker').MozOpacity = 0.6;
$style('_popUpPageBlocker').opacity = 0.6;
}
function hidePopUpPageBlocker(){
if($j('_popUpPageBlocker')){
$style('_popUpPageBlocker').display = 'none';
}
}
function buttonState(obj, state){
var src = '';
switch(obj.id){
case 'add':
src = (state=='rollover') ? imagePath+'/btn_submit_rollover.gif' : imagePath+'/btn_submit.gif';
break;
case 'login':
case 'btnForgotPassword':
src = (state=='rollover') ?  imagePath+'/btn_arrow_rollover.gif' :  imagePath+'/btn_arrow.gif';
break;
case 'send':
src = (state=='rollover') ?  imagePath+'/btn_send_rollover.gif' :  imagePath+'/btn_send.gif';
break;
case 'send2':
src = (state=='rollover') ?  '/images/wsh/btn_send_rollover.gif' :  '/images/wsh/btn_send.gif';
break;
case 'btnSubmitFeedBack':
src = (state=='rollover') ?  imagePath+'/btn_send3_rollover.gif' :  imagePath+'/btn_send3.gif';
break;
}
if(src!='') {
obj.style.backgroundImage = 'url('+src+')';
}
}
var popUps = [];
function showLoginForm_bak(option)
{
var id  = 'popupLogin';
var url = 'signup.php';
if(option!=null){
url += '?'+option;
}
if(!popUps[id]) {
popUps[id] = new PopUpWindow(id, url, 715, 380);
}
popUps[id].show();
}
function showActivationPopUp(key)
{
	if(key=='') return;
	var url = '/popups/activation.php?key='+key;
	
	sendNotification("openPopup",{
		id: '#iframeActivation',
		url: url,
		width: 715,
		height:350	
	});
}
function showSyncProfileMessage()
{
var id='popupSyncProfile';
var url = 'syncProfile.php';
if(!popUps[id]) {
popUps[id] = new PopUpWindow(id, url, 485, 180);
}
popUps[id].show();
}
function showFacebookInviteFriends()
{
var id='popupInviteFacebookFriends';
var url = 'inviteFacebookFriends.php';
if(!popUps[id]) {
popUps[id] = new PopUpWindow(id, url, 680,480);
}
popUps[id].show();
}
var dialogPopUps = [];
function checkSearchTerm(form){
if(form.searchText.value=='' || trim(form.searchText.value)==''){
alert('Please enter search text.');
return false;
}return true;
}
var currentSelectedIcon = null;
function showRollOverIconSet(divId){
$j(divId).className = 'iconSet_rollover';
var id = divId.replace('icon_','label_');
$j(id).className = 'iconSet_rollover_label';
}
function showNormalIconSet(divId){
if($j(divId).getAttribute('oSelected')=='false' || !$j(divId).getAttribute('oSelected')){
$j(divId).className = 'iconSet_normal';
var id = divId.replace('icon_','label_');
$j(id).className = 'iconSet_normal_label';
}
}
function selectIconSet(divId){
if(currentSelectedIcon!=null && currentSelectedIcon==$j(divId))
return;
if(currentSelectedIcon!=null) {
currentSelectedIcon.setAttribute('oSelected',false);
showNormalIconSet(currentSelectedIcon.id);
}
$j(divId).setAttribute('oSelected',true);
currentSelectedIcon = $j(divId);
}
function sendEmailToStoryTeller(username, uid, name) {
	sendNotification("sendEmailToStoryTeller",{
		uid: uid,
		name: name
	});
}
function postToTwitter(name, movieId, commentId, username, movieCategory) {
if(name=='') return;
if(typeof(commentId)=='undefined'){
commentId = '';
}
if(typeof(username)=='undefined'){
username = '';
}
if(typeof(movieCategory)=='undefined'){
movieCategory = '';
}
var id = 'dlgPostTwitter';
var movieUrl= 'http%3A%2F%2Fcutv.ws%2F' + movieId;
var text;
if(commentId!='')
{
movieUrl += '%3FcommentId%3D'+commentId;
text = username + ' commented on "' + name +'", a '+movieCategory+' documentary. ';
}
else
{
text = "I'm watch'in " + name + ".";
}
text = escape(text);
var url = 'http://twitter.com/share?count=horizontal&counturl=' + movieUrl + '&original_referer=http%3A%2F%2Fcultureunplugged.com%2F&text=' + text + '&url=' + movieUrl + '&via=worldfilms';
window.open(url,"twitterwindow","menubar=1,resizable=1,scrollbars=1,width=500,height=400");
return;
/*
if(name=='') return;
if(typeof(commentId)=='undefined'){
commentId = '';
}
var id = 'dlgPostTwitter';
var url = 'postToTwitter.php?name='+escape(name)+'&id='+movieId+'&commentId='+commentId;
var title = 'TWEET THIS TO YOUR FRIENDS:';
if(!dialogPopUps[id]){
var h = isIE ? 490 : 460;
dialogPopUps[id] = new PopUpDialog(id, title, url, 380,h);
dialogPopUps[id].remoteServer = false;
dialogPopUps[id].borderColor = '#2A2028';
dialogPopUps[id].backgroundColor = '#00c2ff';
dialogPopUps[id].titleColor = '#2A2028';
dialogPopUps[id].closeIcon = 'btn_close5.gif';
dialogPopUps[id].offsetX = 34;
}
dialogPopUps[id].title = title;
dialogPopUps[id].url = url;
dialogPopUps[id].show();
*/
}
function showTwitterIconRollOver(){
rollOverImage($j('twitterIcon'));
$j('label_twitter').className = 'iconSet_rollover_label';
}
function showTwiiterIcon(){
normalImage($j('twitterIcon'));
$j('label_twitter').className = 'iconSet_normal_label';
}
function removeFromWatchLater(movieId) {
var params = 'movieId='+movieId;
doAJAXGet('/ajax/removeWatchLater.php', params, 'onRemoveFromWatchLater');
var obj = document.getElementById('watchlater_'+movieId);
if(obj) {
obj.parentNode.removeChild(obj);
}
}
function onRemoveFromWatchLater(res) {
alert('Movie has been removed from the watch later list.');
var obj = json_decode(res.responseText);
if(obj.movieId && $j('wl_'+obj.movieId)) {
var elm = $j('wl_'+obj.movieId);
elm.parentNode.removeChild(elm);
}
if(watchlaterlist) {
watchlaterlist = null;
getWatchLaterPlaylist();
}
}
function removeFromFavorites(movieId) {
var params = 'movieId='+movieId;
doAJAXGet('/ajax/removeFromFavorites.php', params, 'onRemoveFromFavorites');
var obj = document.getElementById('fav_'+movieId);
if(obj) {
obj.parentNode.removeChild(obj);
}
}
function onRemoveFromFavorites(res) {
alert('Movie has been removed from the favorites.');
var obj = json_decode(res.responseText);
if(obj.movieId && $j('favFilm_'+obj.movieId)) {
var elm = $j('favFilm_'+obj.movieId);
elm.parentNode.removeChild(elm);
}
if(favorites ){
favorites = [];
}
}
function removeSTFromFavorites(stId){
var params = 'userId='+stId;
doAJAXGet('/ajax/removeStoryTellerFromFavorites.php', params, 'onRemoveSTFromFavorites');
}
function onRemoveSTFromFavorites(res){
alert('StoryTeller has been removed from the favorites.');
var obj = json_decode(res.responseText);
if(obj.userId && $j('favST_'+obj.userId)) {
var elm = $j('favST_'+obj.userId);
elm.parentNode.removeChild(elm);
}
if(favorites ){
favorites = [];
}
}
function setCUCookie(c_name,value,expiredays,path)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())+
((path==null) ? "" : ";path="+path);
}
function readCookie(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;
}
var favFilmsIndex = 0;
var favStIndex = 0;
var watchIndex = 0;
function showPrevFavFilms(){
$j('ffc_'+favFilmsIndex).style.display = 'none';
favFilmsIndex--;
$j('ffc_'+favFilmsIndex).style.display = 'block';
$j('iconFavFilmsDown').style.display = '';
$j('iconFavFilmsUp').style.display = (favFilmsIndex==0)?'none':'';
}
function showNextFavFilms(){
$j('ffc_'+favFilmsIndex).style.display = 'none';
favFilmsIndex++;
var nextIndex = favFilmsIndex+1;
$j('ffc_'+favFilmsIndex).style.display = 'block';
$j('iconFavFilmsUp').style.display = '';
$j('iconFavFilmsDown').style.display = (!$j('ffc_'+nextIndex)) ? 'none':'';
}
function showPrevFavSt(){
$j('stc_'+favStIndex).style.display = 'none';
favStIndex--;
$j('stc_'+favStIndex).style.display = 'block';
$j('iconFavStDown').style.display = '';
$j('iconFavStUp').style.display = (favStIndex==0)?'none':'';
}
function showNextFavSt(){
$j('stc_'+favStIndex).style.display = 'none';
favStIndex++;
var nextIndex = favStIndex+1;
$j('stc_'+favStIndex).style.display = 'block';
$j('iconFavStUp').style.display = '';
$j('iconFavStDown').style.display = (!$j('stc_'+nextIndex)) ? 'none':'';
}
function showPrevWatchLater(){
$j('wlc_'+watchIndex).style.display = 'none';
watchIndex--;
$j('wlc_'+watchIndex).style.display = 'block';
$j('iconWatchDown').style.display = '';
$j('iconWatchUp').style.display = (watchIndex==0)?'none':'';
}
function showNextWatchLater(){
$j('wlc_'+watchIndex).style.display = 'none';
watchIndex++;
var nextIndex = watchIndex+1;
if($j('wlc_'+watchIndex)) {
$j('wlc_'+watchIndex).style.display = 'block';
}
$j('iconWatchUp').style.display = '';
$j('iconWatchDown').style.display = (!$j('wlc_'+nextIndex)) ? 'none':'';
}
function rollOutImage(div) { if(div.src) div.src = div.src.replace('_rollover',''); }
function showContributePopup(title, userId, name, movieId)
{
	sendNotification("showContributeDialog",{
		uid: userId,
		movieId: movieId,
		name: name,
		title: title
	});
}
function showNoContributePopup(title, userId, name)
{
var id = 'dlgShowNoContributePopup';
var url = 'noContribute.php?st='+userId+'&name='+name+'&title='+title;
if(!dialogPopUps[id]){
dialogPopUps[id] = new PopUpDialog(id, title, url, 686,540);
dialogPopUps[id].offsetX = 82;
dialogPopUps[id].remoteServer = false;
}
dialogPopUps[id].title = 'CONTRIBUTE TO PROMOTE KINDNESS';// + title.toUpperCase();
dialogPopUps[id].show();
}
function showPayPalPolicy()
{
var url = 'https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=ua/AcceptableUse_print&locale.x=en_US';
window.open(url,"paypalwindow","menubar=1,resizable=1,scrollbars=1,width=800,height=700");
}
function loadExploreCollection(page) {
if(typeof(page)=='undefined') {
page = 1;
}
var d = new Date();
$.get(
'/ajax/getExploreCollectionList.php',
'page='+page+'&t='+d.getTime(),
function(res) { parseExploreCollection(res); },
'json'
);
}
function parseExploreCollection(res) {
var str = '';
var page = res.page;
var pages = res.totalPages;
for(var i=0;i<res.data.length;i++) {
var item = res.data[i];
str += '<li><a href="/'+item.type+'/explore/'+item.alias+'">'+item.organization+'</a>';
}
$('#exploreCollections').html(str).attr('pages',pages).attr('page',page);
if(pages>page) {
$('#nextCollections').show();
}
else {
$('#nextCollections').hide();
}
if(page>1) {
$('#prevCollections').show();
}
else {
$('#prevCollections').hide();
}
}
function loadPrevExploreCollection() {
var page = parseInt($('#exploreCollections').attr('page'))-1;
loadExploreCollection(page);
}
function loadNextExploreCollection() {
var page = parseInt($('#exploreCollections').attr('page')) + 1;
loadExploreCollection(page);
}
function hideAllPopUps() {
}
function hideAllFlashPlayers(){
var i = 0;
while($j('previewPlayer_'+i)){
$style('previewPlayer_'+i).visibility = 'hidden';
$style('previewPlayerThumbnail_'+i).display = 'block';
i++;
}
if(typeof(PreviewPlayer)!='undefined' && PreviewPlayer.pauseAll) {
PreviewPlayer.pauseAll();
}
if($j('embedVideoPlayer')){
$style('embedVideoPlayer').visibility = 'hidden';
}
if($j('musicList')){
$style('musicList').visibility = 'hidden';
}
}
function showAllFlashPlayers(){
var i = 0;
if($j('embedVideoPlayer')){
$style('embedVideoPlayer').visibility = 'visible';
}
if($j('musicList')){
$style('musicList').visibility = 'visible';
}
}
function showReportProblem()
{
	sendNotification("showReportBugDialog");
}
function showSendEmailToStoryTeller(title, userId, name, exploreWork)
{
	sendNotification("sendEmailToStoryTeller", {
		uid : userId,
		name : name,
		collaborate: exploreWork				
	});
}
function showSubmitFilmForm(){
var id  = 'dlgSubmitFilm';
var url = 'filmedia/submitFilm_about.php';
var title = 'SUBMIT YOUR FILM:';
if(!dialogPopUps[id]){
dialogPopUps[id] = new PopUpDialog(id, title, url, 880,1200);
dialogPopUps[id].offsetX = 50;
}
dialogPopUps[id].show();
}
function showInvitation() {
window.location = serverURL + '/documentary/watch-online/festival/inviteFriends.php';
return;
var id  = 'popupSendInvitation';
var url = 'filmedia/sendInvitation.php';
if(!popUps[id]) {
var h = isIE?392:382;
popUps[id] = new PopUpWindow(id, url, 583, h);
popUps[id].borderWidth = 6;
popUps[id].padding = 6;
popUps[id].borderColor = '#e40045';
popUps[id].backgroundColor = '#FFF';
popUps[id].backgroundImage = 'url('+imagePath+'/spacer.gif)';
}
else if($style(id).display!='none'){
return;
}
popUps[id].show();
}
function showMobilifePopUp()
{
var id  = 'popupMobilife';
var url = 'filmedia/specialForYou.php';
if(!popUps[id]) {
popUps[id] = new PopUpWindow(id, url, 830, 1340);
popUps[id].borderWidth = 6;
popUps[id].padding = 6;
popUps[id].borderColor = '#E10043';
popUps[id].backgroundColor = '#2a1f28';
popUps[id].backgroundImage = 'url('+imagePath+'/spacer.gif)';
}
popUps[id].show();
}
function showLoginForm(option)
{
var url = '/topdocumentaries/watch-online/filmedia/login.php?r='+escape(window.location.toString());
if(option!=null){
url += '&'+option;
}
window.location = url;
}
function init() {
setPageBlockerHeight();
if(window.onInitialize){ onInitialize(); }
}
var stPopUpTimer;
function showStoryTellerInfo(id, index){
if(stPopUpTimer) clearTimeout(stPopUpTimer);
var popUpId = '_popUpStoryTellerInfo';
if(!$j(popUpId)){
var div = document.createElement('div');
div.id = popUpId;
with(div.style){
position = 'absolute';
border = '2px solid #282028';
backgroundColor = '#FFFFFF';
width = '340px';
padding = '15px';
display = 'none';
zIndex = 900;
}
div.onmouseout = hideStoryTellerInfo;
div.onmouseover = function(){ if(stPopUpTimer){clearTimeout(stPopUpTimer);} };
$j('info_u_'+id).parentNode.appendChild(div);
}
var x = 40 + parseInt(index)%5 * 137;
var y = 305 + Math.floor(parseInt(index)/5) * 182;
$style(popUpId).top = y + 'px';
$style(popUpId).left= x + 'px';
$j(popUpId).innerHTML = $j('info_u_'+id).innerHTML;
$style(popUpId).display = 'block';
}
function hideStoryTellerInfo(){
stPopUpTimer = setTimeout('dismissStoryTellerPopUp()',300);
}
function dismissStoryTellerPopUp()
{
var popUpId = '_popUpStoryTellerInfo';
if($j(popUpId)) $style(popUpId).display = 'none';
if(stPopUpTimer) clearTimeout(stPopUpTimer);
}
function showJoinExperts() {
var id  = 'dlgJoinExperts';
var url = 'filmedia/joinExperts.php';
var title = 'JOIN DIRECTORY of EXPERTS:';
if(!dialogPopUps[id]){
dialogPopUps[id] = new PopUpDialog(id, title, url, 940,1100);
dialogPopUps[id].offsetX = 50;
dialogPopUps[id].top = 58;
}
dialogPopUps[id].show();
}
function showPopUp(url, w, h){
showPageBlocker();
if($j('_popUp') == null) {
var iframe = document.createElement('iframe');
iframe.id = '_popUp';
iframe.setAttribute('frameBorder',0);
iframe.scrolling = 'no';
with(iframe.style) {
position = 'absolute';
width    = w + 'px';
height   = h +'px';
padding  = '8px';
border   = '4px solid #ffffff';
zIndex   = 1000;
background = '#647996 url('+imagePath+'/bg_647996.gif)';
overflow = 'hidden';
dispaly  = 'none';
}
$j('wrapper').appendChild(iframe);
}
else {
var iframe = $j('_popUp');
}
var x = ($j('wrapper').offsetWidth - w) /2 ;
var y = 100 + getPageOffset().y;
iframe.src = '/popups/'+url;
iframe.style.left = x + 'px';
iframe.style.top  = y + 'px';
iframe.style.display = 'block';
createPopUpCloseButton(x+w-30, y+28).style.display = 'block';
}
function closePopUp2() {
if($j('_btn_popUpClose')){
$style('_btn_popUpClose').display = 'none';
}
if($j('_popUp')) {
$style('_popUp').display = 'none';
$j('_popUp').src = '/popups/blank.html';
}
hidePageBlocker();
}
function createPopUpCloseButton(x,y){
if($j('_btn_popUpClose') == null) {
var div = document.createElement('div');
div.id = '_btn_popUpClose';
div.style.position = 'absolute';
div.style.zIndex = 1001;
div.innerHTML = '<a href="javascript:closePopUp2()"><img src="'+imagePath+'/btn_close.gif" alt=""/></a>';
$j('wrapper').appendChild(div);
}
else {
var div = $j('_btn_popUpClose');
}
div.style.top = y + 'px';
div.style.left = x + 'px';
return div;
}
var FormHandler = {
form : null,
url : '',
elements : [],
fakeFileUpload : null,
fakeFileUploadImage :  imagePath+'/form_file.gif',
fakeFileUploadImageTopMargin : '0px',
fakeFileHeight : '16px',
uploadButtonMargin : 0,
imgCheckboxOn  :  imagePath+'/form_check_on.gif',
imgCheckboxOff :  imagePath+'/form_check_off.gif',
imgRadioOn  :  imagePath+'/form_radio_on.gif',
imgRadioOff :  imagePath+'/form_radio_off.gif',
focusedElement : null,
allowModifyFileFiled : true
}
/*
* Add this method to initilization function in order to make it work.
* For example: onload = FormHandler.init();
*/
FormHandler.init = function(form)
{
FormHandler.setForm(form);
FormHandler.createFakeFileUploader();
FormHandler.setFieldValues(FormHandler.elements);
}
FormHandler.setForm = function(form)
{
if(form){
FormHandler.form = form;
}
else {
FormHandler.form = document.forms[0];
}
FormHandler.url  = FormHandler.form.action;
FormHandler.elements = FormHandler.form.elements;
}
/*
* Called before form is submitted.
*
* @param string callback fuction, only needed when performing ajax post.
*/
FormHandler.onSubmit = function(callback)
{
if(FormHandler.validateForm(FormHandler.form)){
if(window.onSubmit){
onSubmit();
}
if(callback){
doAJAXPost(FormHandler.url, FormHandler.form, callback);
}
else {
return true;
}
}
if(FormHandler.form.submitAction) {
FormHandler.form.submitAction.value = '';
}
return false;
}
/*
* Validates form values (override this method as needed)
*/
FormHandler.validateForm = function()
{
return true;
}
FormHandler.setFieldValues = function(elements)
{
var elm;
for(var i=0; i < elements.length; i++){
elm = elements[i];
if(elm.getAttribute('oValue') && elm.type!='file'){
if(elm.type=='password' && elm.value==''){
if(elm.name!='password') {
try {
elm.setAttribute('type','text');
if(elm.value=='') {
elm.value = elm.getAttribute('oValue');
}
elm.onfocus  = FormHandler.clearFieldValue;
elm.onblur   = FormHandler.checkFieldValue;
}
catch(e) { }
}
}
else {
if(elm.value=='' || elm.value==null) {
elm.value = elm.getAttribute('oValue');
}
elm.onfocus = FormHandler.clearFieldValue;
elm.onblur  = FormHandler.checkFieldValue;
}
}
else if(elm.type=='file'){
FormHandler.applyFakeFileUploader(elm);
}
else if(elm.type=='checkbox'){
FormHandler.replaceCheckbox(elm);
}
else if(elm.type=='radio'){
FormHandler.replaceRadio(elm);
}
else if(elm.type=='submit') {
if(FormHandler.form && FormHandler.form.submitAction){
elm.onclick = function()
{
FormHandler.form.submitAction.value = this.name;
}
}
}
}
}
FormHandler.checkFieldValue = function()
{
if(trim(this.value).toLowerCase() == ''){
this.value = this.getAttribute('oValue');
if(/PASSWORD/.test(this.getAttribute('oValue'))){
try { this.type = 'text'; }
catch(e) {};
}
}
FormHandler.focusedElement = null;
}
FormHandler.clearFieldValue = function()
{
if(FormHandler.focusedElement == this) return;
if(/PASSWORD/.test(this.getAttribute('oValue'))){
try {this.type='password'; }
catch(e) {}
}
if(trim(this.value).toLowerCase() == this.getAttribute('oValue').toLowerCase()){
this.value = '';
}
FormHandler.focusedElement = this;
}
FormHandler.setFileUplodeImage = function(src,marinTop)
{
FormHandler.fakeFileUploadImage = src;
FormHandler.fakeFileUploadImageTopMargin = marinTop;
}
FormHandler.createFakeFileUploader = function()
{
if (!W3CDOM) return;
var image = document.createElement('img');
image.src= FormHandler.fakeFileUploadImage;
image.style.cursor = 'pointer';
image.style.verticalAlign = 'middle';
image.style.position = 'absolute';
image.style.top = FormHandler.fakeFileUploadImageTopMargin;
image.style.left = '0px';
var input = document.createElement('input');
input.style.position = 'absolute';
input.style.top = '0px';
input.style.left = '0px';
input.style.marginTop = '0px';
input.style.height = FormHandler.fakeFileHeight;
FormHandler.fakeFileUpload = document.createElement('div');
FormHandler.fakeFileUpload.className = 'fakefile';
FormHandler.fakeFileUpload.appendChild(input);
FormHandler.fakeFileUpload.appendChild(image);
}
FormHandler.applyFakeFileUploader = function(elm)
{
if (!W3CDOM) return;
if(elm.type != 'file' || elm.parentNode.className != 'fileinputs') return;
elm.className = 'file';
var clone = FormHandler.fakeFileUpload.cloneNode(true);
elm.parentNode.appendChild(clone);
elm.relatedElement = clone.getElementsByTagName('input')[0];
elm.relatedElement.style.width = elm.style.width;
var marginLeft = parseInt(FormHandler.uploadButtonMargin);
var imgX = parseInt(elm.style.width) + parseInt(isNaN(marginLeft)?0:marginLeft); //+2
clone.getElementsByTagName('img')[0].style.left = imgX + 'px';
if(!FormHandler.allowModifyFileFiled){
elm.relatedElement.onfocus = function(){ this.blur(); return false; }
elm.relatedElement.onkeypress = function(){ return false; }
}
elm.onchange = elm.onmouseout = function ()
{
this.relatedElement.value = this.value;
}
if(elm.getAttribute('oValue')){
elm.relatedElement.value = elm.getAttribute('oValue');
}
}
FormHandler.replaceCheckbox = function(elm)
{
if(elm.getAttribute('type') == 'checkbox') {
var img = document.createElement('img');
if(elm.checked) {
img.src = FormHandler.imgCheckboxOn;
} else {
img.src = FormHandler.imgCheckboxOff;
}
img.id = '_checkImage_'+elm.id;
img.style.verticalAlign = 'middle';
img.style.marginTop = '1px';
img.onclick = FormHandler.checkChange;
elm.parentNode.insertBefore(img, elm);
img.style.zIndex = 3;
elm.style.display='none';
}
}
FormHandler.checkChange = function()
{
var name = this.id.replace('_checkImage_','');
var elm = $j(name);
if(elm.disabled) return;
if(elm.checked) {
FormHandler.selectCheckbox(elm, false);
} else {
FormHandler.selectCheckbox(elm, true);
}
if(window.onCheckboxClicked) {
onCheckboxClicked(elm);
}
}
FormHandler.selectCheckbox = function(elm, chk)
{
var id = '_checkImage_'+elm.id;
if(chk) {
elm.checked = 'checked';
if(document.getElementById(id))
document.getElementById(id).src=FormHandler.imgCheckboxOn;
}
else {
elm.checked = '';
if(document.getElementById(id))
document.getElementById(id).src=FormHandler.imgCheckboxOff;
}
}
FormHandler.replaceRadio = function(elm)
{
if(elm.getAttribute('type') == 'radio') {
var img = document.createElement('img');
if(elm.checked) {
img.src = FormHandler.imgRadioOn;
} else {
img.src = FormHandler.imgRadioOff;
}
img.id = '_radioImage_'+elm.id;
img.style.verticalAlign = 'middle';
img.onclick = FormHandler.radioChange;
elm.parentNode.insertBefore(img, elm);
img.style.zIndex = 3;
elm.style.display='none';
}
}
FormHandler.radioChange = function()
{
var id = this.id.replace('_radioImage_','');
var elm = $j(id);
var name = elm.name;
var form = elm.form;
for(var j=0; j<form.elements.length; j++){
var element = form.elements[j];
if(element.type=='radio' && element.name==name){
var imgId = '_radioImage_' + element.getAttribute('id');
if(element==elm){
element.checked = true;
document.getElementById(imgId).src=FormHandler.imgRadioOn;
}
else {
element.checked = false;
document.getElementById(imgId).src=FormHandler.imgRadioOff;
}
}
}
if(window.onChangeRadioButton){
onChangeRadioButton(form);
}
}
/*
* Checks to see if the field value has been updated.
*
* @param Object obj, form field object
* @return Boolean
*/
FormHandler.isValueUpdated = function(obj)
{
return !(trim(obj.value)=='' || (obj.getAttribute('oValue') && trim(obj.value.toLowerCase())==obj.getAttribute('oValue').toLowerCase()));
}
function isValueUpdated(obj) {
return FormHandler.isValueUpdated(obj);
}
function textCounter(field, maxlength) {
if (field.value.length > maxlength) {
field.value = field.value.substring(0, maxlength);
}
}
function AJAX(url, callback) {
var req = init();
req.onreadystatechange = processRequest;
function init() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
}
}
function processRequest () {
if (req.readyState == 4) {
if (req.status == 200) {
if (callback) {
	if(typeof(callback)=='function') {
		callback(req);
	}
	else {
		eval(callback+"(req)");
	}
	
}
}
}
}
this.doGet = function() {
req.open("GET", url, true);
req.send(null);
}
this.doPost = function(body) {
req.open("POST", url, true);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.send(body);
}
}
function doAJAXPost(url, form, callback) {
var ajax = new AJAX(url, callback);
var param = '';
for(var i=0;i<form.elements.length;i++){
var elm = form.elements[i];
if(typeof(elm.value)=='undefined' || (elm.type=='checkbox' && !elm.checked))
continue;
if(i>0) param += '&';
param += elm.name+'='+URLEncode(elm.value);
}
ajax.doPost(param);
}
function doAJAXGet(url,params,callback) {
url = url + '?' + params + '&_d_='+(new Date).getTime();
var ajax = new AJAX(url, callback);
ajax.doGet();
}
function addToWatchLaterList(movieId){
$.get('/ajax/addToWatchLater.php', {movieId:movieId}, function(res) {if(!res.isOK){
			if(res.needLogin){
				showLoginForm('cmd=addToWatchLaterList('+res.movieId+')');
			}
			else {
				alert(res.message);
				if(window.onAfterPopUpCommand){
					window.onAfterPopUpCommand();
				}
			}
		}
		else {
			alert(res.message);
			if(window.onAfterPopUpCommand){
				window.onAfterPopUpCommand();
			}
		}
	}, 'json');
}
function getScriptsList()
{
var _t = new Date().getTime();
$.get('/ajax/getScriptsList.php?_='+_t, {uid:currentUserId}, onGetScriptsList, 'json');
}
function onGetScriptsList(result)
{
clearScriptsList();
if($j('iconUpdateScripts')){
$style('iconUpdateScripts').display = (result.length>0)?'':'none';
}
var table = $j('scriptsList');
var row, col;
if(result.length<=0) {
var div = document.createElement('div');
div.id = '_scriptId';
div.style.color = '#f00';
div.style.fontSize = '13px';
div.style.margin = '10px 15px';
div.innerHTML = 'I will upload here soon...';
table.parentNode.insertBefore(div,table);
table.style.display = 'none';
return;
}
var numRows = 0;
var numCols = 4;
var width  = Math.floor(100/numCols);
var border =  '1px dashed #999999';
var maxChars = 22;
if(result.length>0){
for(var i=0;i<result.length;i++){
if(i%numCols==0){
row = table.insertRow(numRows++);
}
col = row.insertCell(i%numCols);
col.style.width = width+'%';
if(i%numCols!=numCols-1)
col.style.borderRight = border;
var desc = result[i].desc;
var hint = '';
if(result[i].desc.length>maxChars) {
desc = result[i].desc.substr(0,maxChars-3)+'...';
hint = ' title="'+result[i].desc+'"';
}
col.innerHTML = '<a class="script-name" href="/getFile.php?id='+result[i].storageId+'" target="_blank" style="color:#000"'+hint+'>'+desc+'</a>';
if(editMode){
col.innerHTML += '<br/><a href="javascript:deleteScripts('+result[i].id+')">(Remove)</a>';
}
}
if(i>0 && i%numCols!=0){
for(var j=i%numCols;j<numCols;j++){
col = row.insertCell(j%numCols);
col.style.width = width+'%';
if(j%numCols!=numCols-1 && numRows>1) col.style.borderRight = border;
col.innerHTML = '&nbsp;';
}
}
if($j('_scriptId')) $style('_scriptId').display = 'none';
table.style.display = 'block';
}
else {
if($j('_scriptId')) $style('_scriptId').display = 'block';
table.style.display = 'none';
}
}
function clearScriptsList()
{
var table = $j('scriptsList');
while(table.rows.length>0){
table.deleteRow(table.rows.length-1);
}
}
function deleteScripts(id)
{
if(confirm('Are you sure?')){
var _t = new Date().getTime();
$.get('/ajax/deleteScripts.php?_='+_t, {id:id}, onGetScriptsList, 'json');
}
}
function getPhotoList() {
var _t = new Date().getTime();	
$.get('/ajax/getPhotoList.php?_='+_t, {uid:currentUserId}, onGetPhotoList, 'json');
}
var numPhotos = 0;
function onGetPhotoList(result)
{
clearPhotoList();
numPhotos = result.length;
if($j('iconUpdatePhotoMusic')){
$style('iconUpdatePhotoMusic').display = (numPhotos+numTracks)>0?'':'none';
}
if(result.length<=0) {
var div = document.createElement('div');
div.id = '_scriptId';
div.style.color = '#f00';
div.style.fontSize = '13px';
div.style.margin = '10px 15px';
div.innerHTML = 'I will upload here soon...';
$j('photoList').parentNode.insertBefore(div,$j('photoList'));
$j('photoList').style.display = 'none';
return;
}
for(var i=0;i<result.length;i++){
var image = new Image();
image.src = '/getFile.php?type=image&thumbnail=1&id='+result[i].storageId;
image.style.margin = '0px 10px 5px 0px';
if(image.width>680) {
image.width = 680;
}
if($j('photoList')){
$j('photoList').appendChild(image);
}
}
}
function clearPhotoList()
{
$j('photoList').innerHTML = '';
}
var mp = null;
var numTracks = 0;
function getMusicList()
{
var _t = new Date().getTime();		
$.get('/ajax/xspf_playlist.php?_='+_t, {uid:currentUserId}, onGetMusicList);
}
function onGetMusicList(data)
{
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(data);
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
parser=new DOMParser();
xmlDoc=parser.parseFromString(data,"text/xml");
}
catch(e) {alert(e.message)}
}
numTracks = xmlDoc.getElementsByTagName('track').length;
if($j('iconUpdatePhotoMusic')){
$style('iconUpdatePhotoMusic').display = (numPhotos+numTracks)>0?'':'none';
}
if(numTracks>0){
$j('musicList').innerHTML = '';
if(mp)mp = null;
mp = new SWFObject("/swf/xspf_player.swf", "mp", "400", "170", "8.0.0.0", "#2A1F28");
mp.addParam("width", "400");
mp.addParam("height", "170");
mp.addParam("quality", "high");
mp.addParam("bgcolor", "#2A1F28");
mp.addParam("allowFullScreen","false");
mp.addParam("allowScriptAccess","sameDomain");
mp.addParam("type", "application/x-shockwave-flash");
mp.addParam("wmode","opaque");
mp.addParam("pluginspage", "http://www.adobe.com/go/getflashplayer");
mp.addParam("flashvars", "playlist_url=/ajax/xspf_playlist.php?uid="+currentUserId);
mp.write("musicList");
$style('musicList').display = 'block';
}
else {
$style('musicList').display = 'none';
}
}
var favorites = [];
function getMyFavorites(type, rowIndex)
{
//$style('favoritesubmenu').top = (120+rowIndex*22) + 'px';
var ul = $j('myfavoritelist');
ul.innerHTML = '';
if(favorites[type]){
onGetMyFavorites(favorites[type]);
}
else {
doAJAXGet('/ajax/getMyFavorites.php','type='+type,'onGetMyFavorites');
}
}
function onGetMyFavorites(res)
{
var obj = json_decode(res.responseText);
var ul = $j('myfavoritelist');
var li;
var sURL="";
if(window.location.href.indexOf('http://truthseeker')!=-1){
sURL = serverURL;
}
if(obj.result.length>0) {
for(var i=0;i<obj.result.length;i++){
var fav = obj.result[i];
li = document.createElement('li');
li.innerHTML = '<a href="'+fav.link+'" target="_blank">'+fav.title+'</a>';
ul.appendChild(li);
}
li.style.paddingBottom = '10px';
var li = document.createElement('li');
li.className = 'favUpdateLink';
li.innerHTML = '<a href="'+sURL+'/documentary/watch-online/festival/profile.php">UPDATE</a>';
ul.appendChild(li);
}
else {
li = document.createElement('li');
li.innerHTML = 'No Entry';
ul.appendChild(li);
}
$style('favoritesubmenu').display = 'block';
favorites[obj.type] = res;
}
var watchlaterlist;
function getWatchLaterPlaylist()
{
if(watchlaterlist){
onGetWatchLaterPlaylist(watchlaterlist);
}
else {
doAJAXGet('/ajax/getWatchLaterList.php','','onGetWatchLaterPlaylist');
}
}
function onGetWatchLaterPlaylist(res)
{
var obj = json_decode(res.responseText);
var ul = $j('mywatchlaterlist');
var li;
var sURL="";
if(window.location.href.indexOf('http://truthseeker')!=-1){
sURL = serverURL;
}
while(ul.hasChildNodes()) {
ul.removeChild(ul.firstChild);
}
if(obj.result.length>0) {
for(var i=0;i<obj.result.length;i++){
var fav = obj.result[i];
li = document.createElement('li');
li.innerHTML = '<a href="'+fav.link+'" target="_blank">'+fav.title+'</a>';
ul.appendChild(li);
}
li.style.paddingBottom = '10px';
var li = document.createElement('li');
li.className = 'favUpdateLink';
li.innerHTML = '<a href="'+sURL+'/documentary/watch-online/festival/profile.php" style="text-decoration:none">UPDATE</a>';
ul.appendChild(li);
}
else {
li = document.createElement('li');
li.innerHTML = 'You have no movies selected';
ul.appendChild(li);
}
watchlaterlist = res;
}
function getLookingForFund()
{
var _t = new Date().getTime();
$.get('/ajax/getLookingForFund.php?_='+_t, {uid:currentUserId},
function(obj){
var datePosted = '';
var desc = '';
if(obj.datePosted) {
datePosted = obj.datePosted
desc = obj.desc;
}
if(desc==''){
desc = '<span style="color:#f00">I am working on project(s) but not looking for fund/people at present.</span>';
}
if($j('iconUploadLookingForFund')){
$style('iconUploadLookingForFund').display = (obj.datePosted)?'none':'';
}
if($j('iconUpdateLookingForFund')){
$style('iconUpdateLookingForFund').display = (obj.datePosted)?'':'none';
}
if($j('lookingForFundDate')){
$j('lookingForFundDate').innerHTML = datePosted;
}
if($j('lookingForFundMessage')){
$j('lookingForFundMessage').innerHTML = desc;
}
}, 'json');
}
function getAwardPressList()
{
var _t = new Date().getTime();
$.get('/ajax/getAwardPressList.php?_='+_t, {uid:currentUserId}, onGetAwardPressList, 'json');
}
function clearAwardPressList()
{
if($j('awardsPress_list')) $j('awardsPress_list').innerHTML  = '';
if($j('awardsPress_links')) $j('awardsPress_links').innerHTML  = '';
if($j('awardsPress_dashed')) $style('awardsPress_dashed').display = 'none';
}
function onGetAwardPressList(arr)
{
var updated = 0;
clearAwardPressList();
if(arr.length<=0) {
var div = document.createElement('div');
div.id = '_scriptId';
div.style.color = '#f00';
div.style.fontSize = '13px';
div.style.margin = '10px 0';
div.innerHTML = 'I will upload here soon...';
$j('awardsPress_list').parentNode.insertBefore(div,$j('awardsPress_list'));
$j('awardsPress_list').style.display = 'none';
return;
}
for(var i=0;i<arr.length;i++){
var obj = arr[i];
if(obj.type=='M' && $j('awardsPress_list')) {
$j('awardsPress_list').innerHTML = obj.message;
updated++;
}
else if(obj.type=='L' && $j('awardsPress_links')){
var link = obj.message;
var href = link;
if(!/^http/.test(href)) href = 'http://'+href;
$j('awardsPress_links').innerHTML += '<a href="'+href+'" target="_blank">'+link+'</a><br/>';
updated++;
}
}
if($j('awardsPress_dashed')){
$style('awardsPress_dashed').display =  (updated>1) ? 'block' : 'none';
}
if($j('iconUploadAwards')){
$style('iconUploadAwards').display = (updated>0)?'none':'';
}
if($j('iconUpdateAwards')){
$style('iconUpdateAwards').display = (updated>0)?'':'none';
}
}
function getBlogPostList()
{
var _t = new Date().getTime();	
$.get('/ajax/getBlogPostList.php?_='+_t, {uid:currentUserId}, onGetBlogPostList, 'json');
}
function onGetBlogPostList(arr)
{
if($j('iconUpdateBlogPost')){
$style('iconUpdateBlogPost').display = arr.length>0?'':'none';
}
$j('blogPost_list').innerHTML = '';
if(arr.length<=0) {
var div = document.createElement('div');
div.id = '_scriptId';
div.style.color = '#f00';
div.style.fontSize = '13px';
div.style.margin = '10px 15px';
div.innerHTML = 'I will upload here soon...';
$j('blogPost_list').parentNode.insertBefore(div,$j('blogPost_list'));
$j('blogPost_list').style.display = 'none';
return;
}
for(var i=0;i<arr.length;i++){
var post = arr[i];
var hdl = document.createElement('div');
hdl.className = 'fontTimes hdr12';
hdl.style.margin = '3px 0px';
hdl.innerHTML = post.headline;
if(window.location.toString().indexOf('/profile.php')!=-1) {
hdl.innerHTML += ' <span style="font-family:Arial;font-size:11px">( <a href="javascript:showBlogPostEditor('+post.id+')">Edit</a> | <a href="#" onclick="deleteBlogPost('+post.id+');return false;">Delete</a> )</span>';
}
var sub = document.createElement('div');
sub.className = 'dateTime';
sub.innerHTML = post.author+' | '+post.datePosted;
var msg = document.createElement('div');
msg.className = 'hdr15';
msg.style.marginTop = '10px';
msg.innerHTML = post.message;
var lnk = document.createElement('div');
lnk.className = 'hdr15';
lnk.style.marginTop = '5px';
lnk.style.marginBottom = '20px';
var href = post.url;
if(!/^http/.test(href)) href = 'http://'+href;
lnk.innerHTML = '<a href="'+href+'" target="_blank">'+post.url+'</a>';
if(i>0){
var dashed = document.createElement('div');
dashed.style.borderBottom = '1px dashed #CCC';
dashed.style.height = '20px';
dashed.style.marginBottom = '15px';
$j('blogPost_list').appendChild(dashed);
}
$j('blogPost_list').appendChild(hdl);
$j('blogPost_list').appendChild(sub);
$j('blogPost_list').appendChild(msg);
$j('blogPost_list').appendChild(lnk);
}
}
function loadJustWatched(){
doAJAXGet('/ajax/getAudienceJustWatched.php', '', 'onLoadJustWatched');
}
function onLoadJustWatched(req)
{
if($j('audienceJustWatched')){
$j('audienceJustWatched').innerHTML = req.responseText;
}
}
function getAllTimeMostViewedMovies(tag)
{
if(currentMostViewedLink == 'alltime'){
return;
}
currentMostViewedLink = 'alltime';
if($j('todayMostViewed')){
$style('todayMostViewed').textDecoration = 'underline';
$style('todayMostViewed').fontWeight = 'normal';
}
if($j('allTimeMostViewed')){
$style('allTimeMostViewed').textDecoration = 'none';
$style('allTimeMostViewed').fontWeight = 'bold';
}
doAJAXGet('/ajax/getAllTimeMostViewed.php','tag='+escape(tag),'onGetMostViewedMovies');
}
var currentMostViewedLink;
function getTodayTopPick(tag)
{
if(currentMostViewedLink!='alltime'){
return;
}
currentMostViewedLink = 'today';
if($j('todayMostViewed')){
$style('todayMostViewed').textDecoration = 'none';
$style('todayMostViewed').fontWeight = 'bold';
}
if($j('allTimeMostViewed')){
$style('allTimeMostViewed').textDecoration = 'underline';
$style('allTimeMostViewed').fontWeight = 'normal';
}
doAJAXGet('/ajax/getTodayTopPick.php','tag='+escape(tag),'onGetMostViewedMovies');
}
function onGetMostViewedMovies(req)
{
$j('topPickList').innerHTML = req.responseText;
}
function getMovieSummary(movieId){
	sendNotification("showMovieSynopsisPopup", { source:'cu', movieId:movieId, index:0 });
}
function onGetMovieSummary(res){
showNormalPopUp('',620,300);
$j('_normalPopUp_content').innerHTML = res.responseText;
}
function addFavoriteStoryTeller()
{
doAJAXGet('/ajax/addToFavoriteStoryTeller.php','userId='+currentUserId, 'onAddFavoriteStoryTeller');
}
function onAddFavoriteStoryTeller(res)
{
if(favorites['storyteller']){
favorites['storyteller'] = null;
}
alert('Updated.');
}
function getLinkTVMovieSummary(movieId){
	sendNotification("showMovieSynopsisPopup", { source:'linktv', movieId:movieId, index:0 });
}
function onGetMovieSummary(res){
showNormalPopUp('',620,300);
$j('_normalPopUp_content').innerHTML = res.responseText;
}
function getLinkTVBrowseList(type, listType, page, numPerPage){
doAJAXGet('/ajax/getLinkTVBrowseList.php', 'numPerPage='+numPerPage+'&type='+type+'&cp='+page+'&listType='+listType, 'onLinkTVBrowseListResult');
}
function onLinkTVBrowseListResult(res){
var res = json_decode(res.responseText);
var div = 'list_'+res.type;
if($j(div)){
$j(div).innerHTML = res.list;
}
}
function PopUpWindow(popUpId, sURL, w, h)
{
this.id          = popUpId;
this.url         = sURL;
this.width       = w;
this.height      = h;
this.padding     = 8;
this.borderWidth = 4;
this.borderStyle = 'solid';
this.borderColor = '#ffffff';
this.backgroundColor = '#647996';
this.backgroundImage = 'url('+serverURL+imagePath+'/bg_647996.gif)';
this.btnCloseOffsetX   = -30;
this.btnCloseOffsetY   =  28;
this.remoteServer = true;
this.showCloseButton = true;
}
PopUpWindow.prototype.getCloseButtonId = function()
{
return this.id+'_btnClose';
};
PopUpWindow.prototype.createCloseButton = function()
{
var btnCloseId = this.getCloseButtonId();
if($j(btnCloseId) == null) {
var iconPath = imagePath.indexOf('http')!=-1 ? imagePath : serverURL+imagePath;
var div = document.createElement('div');
div.id = btnCloseId;
div.style.position = 'absolute';
div.style.zIndex = 1001;
div.innerHTML = '<a href="javascript:closePopUp(\''+this.id+'\')"><img src="'+iconPath+'/btn_close.gif" alt=""/></a>';
$j('wrapper').appendChild(div);
}
};
PopUpWindow.prototype.createMainWindow = function()
{
if($j(this.id) == null) {
var iframe = document.createElement('iframe');
iframe.id = this.id;
iframe.setAttribute('frameBorder',0);
iframe.scrolling = 'no';
with(iframe.style) {
position   = 'absolute';
width      = this.width + 'px';
height     = this.height +'px';
padding    = this.padding + 'px';
border     = this.borderWidth + 'px '+ this.borderStyle+' '+ this.borderColor;
zIndex     = 1000;
background = this.backgroundColor+' '+this.backgroundImage;
overflow = 'hidden';
dispaly  = 'none';
}
if($j('wrapper')) {
$j('wrapper').appendChild(iframe);
}
else if($j('container')) {
$j('container').appendChild(iframe);
}
}
};
PopUpWindow.prototype.show = function()
{
showPageBlocker();
var mainDiv = ($j('wrapper')) ? $j('wrapper') : $j('container');
this.createMainWindow();
if(this.showCloseButton)
this.createCloseButton();
var iframe   = $j(this.id);
var btnClose = $j(this.getCloseButtonId());
var x = (mainDiv.offsetWidth - this.width) /2 ;
var y = 100 + getPageOffset().y;
iframe.src = (this.remoteServer ? serverURL : '')+'/popups/'+this.url;
iframe.style.left = x + 'px';
iframe.style.top  = y + 'px';
iframe.style.display = 'block';
if(this.showCloseButton) {
btnClose.style.top = y+this.btnCloseOffsetY + 'px';
btnClose.style.left = x+this.width+this.btnCloseOffsetX+ 'px';
btnClose.style.display = 'block';
}
};
function closePopUp(id)
{
var btnCloseId = id+'_btnClose';
if($j(btnCloseId)){
$style(btnCloseId).display = 'none';
}
if($j(id)) {
$style(id).display = 'none';
$j(id).src = serverURL+'/popups/blank.html';
}
hidePageBlocker();
}
function PopUpDialog(popUpId, sTitle, sURL, w, h)
{
this.id          = popUpId;
this.title       = sTitle;
this.url         = sURL;
this.width       = w;
this.height      = h;
this.offsetX     = 6;
this.borderWidth = 2;
this.borderStyle = 'solid';
this.borderColor = '#3B3C46';
this.backgroundColor = '#2A1F28';
this.hideIframeBackground = false;
this.top = null;
this.left = null;
this.closeIcon = 'btn_close2.gif';
this.remoteServer = true;
this.titleColor = '#595969';
this.hideCloseButton = false;
}
PopUpDialog.prototype.createMainWindow = function()
{
if(!$j(this.id)){
var div = document.createElement('div');
div.id = this.id;
with(div.style){
position = 'fixed';
border   = this.borderWidth + 'px '+ this.borderStyle+' '+ this.borderColor;
backgroundColor = this.backgroundColor;
zIndex   = 10000;
display = 'none';
}
if(!this.hideCloseButton) {
var div2 = document.createElement('div');
with(div2.style){
position = 'absolute';
right = '10px';
top = '10px';
}
var iconPath = imagePath.indexOf('http')!=-1 ? imagePath : serverURL+imagePath;
div2.innerHTML = '<a href="javascript:closeDialog(\''+this.id+'\')"><img src="'+iconPath+'/'+this.closeIcon+'" alt=""/></a>';
div.appendChild(div2);
}
var div3 = document.createElement('div');
div3.id = this.id+'_title';
with(div3.style){
position = 'absolute';
left = this.offsetX + 'px';
top  = '9px';
fontSize = '15px';
fontWeight = 'bold';
color = this.titleColor;
overflow='hidden';
marginRight='25px';
height='18px';
}
div3.title = this.title;
div3.innerHTML = this.title;
div.appendChild(div3);
var iframe = document.createElement('iframe');
iframe.id = this.id+'_Iframe';
iframe.setAttribute('frameBorder',0);
iframe.scrolling = 'no';
with(iframe.style) {
position = 'absolute';
bottom   = '6px';
left     = '6px';
overflow = 'hidden';
}
div.appendChild(iframe);
if($j('wrapper')) {
$j('wrapper').appendChild(div);
}
else if($j('container')){
$j('container').appendChild(div);
}
}
};
PopUpDialog.prototype.show = function()
{
showPageBlocker();
var mainDiv = ($j('wrapper')) ? $j('wrapper') : $j('container');
var pageOffset = getPageOffset();
var iframeId = this.id+'_Iframe';
this.createMainWindow();
if($j(this.id+'_title')){
$j(this.id+'_title').innerHTML = this.title;
}
$style(this.id).width  = this.width +'px';
$style(this.id).height = this.height +'px';
$style(this.id).left = ((1024-this.width)/2) + 'px';//((this.left!=null) ? this.left : parseInt((mainDiv.offsetWidth - this.width)/2)) +'px';
$style(this.id).top = '100px';//((this.top!=null) ? this.top : (pageOffset.y + 15)) + 'px';
$style(iframeId).width  = (this.width-12) + 'px';
$style(iframeId).height = (this.height-42) +'px';
$j(iframeId).src = (this.remoteServer ? serverURL : '')+'/popups/' + this.url;
if(!this.hideIframeBackground){
$style(iframeId).background = '#696E80 url('+serverURL+imagePath+'/spacer.gif)';
}else {
$style(iframeId).background = '#ffffff';
}
$style(this.id).display = 'block';
};
function closeDialog(id)
{
if($j(id)) {
$style(id).display = 'none';
$j(id+'_Iframe').src = serverURL+'/popups/blank.html';
}
hidePageBlocker();
}
function resizeDialog(id, w, h){
if($j(id)){
if(w>12) {
$j(id).width = w;
$style(id).width = w + 'px';
$style(id+'_Iframe').width = (w-12) + 'px';
}
if(h>42) {
$j(id).height = h;
$style(id).height = h + 'px';
$style(id+'_Iframe').height = (h-42) + 'px';
}
}
}
function centerDialog(id)
{
var mainDiv = $j('wrapper') ? $j('wrapper') : $j('container');
var pageOffset = getPageOffset();
var xx = (mainDiv.offsetWidth - $j(id).width)/2;
$style(id).left = parseInt(xx) +'px';
$style(id).top = (($j(id).top!=null) ? $j(id).top : (pageOffset.y + 15)) + 'px';
}
function resizeAndCenterDialog(id, w, h)
{
resizeDialog(id, w, h);
centerDialog(id);
}
var npBorder1 = '1px solid #4D4C5C';
var npBorder2 = '6px solid #2A1F28'
var npBgColor = '#4D4C5C';
var npBtnClose = (imagePath.indexOf('http')==-1 ? serverURL : '' )+imagePath+'/btn_close3.gif';
var npPosX = -1;
var npPosY = -1;
var npClass = 'normalPopupContent';
function showNormalPopUp(url, w, h){
showPageBlocker();
var popUpId = '_normalPopUp';
var div1 = document.createElement('div');
div1.id = popUpId;
with(div1.style){
position = 'absolute';
zIndex = 1000;
border = npBorder1;
backgroundColor = npBgColor;
}
var div2 = document.createElement('div');
div2.id = popUpId + '_2';
with(div2.style){
position = 'relative';
border = npBorder2;
padding = '20px 0px';
}
var div3 = document.createElement('div');
div3.id = '_btn'+popUpId;
div3.style.position = 'absolute';
div3.style.right = '20px';
div3.style.top = '18px';
div3.style.zIndex = 1001;
div3.innerHTML = '<a href="javascript:closeNormalPopUp()"><img src="'+npBtnClose+'" alt=""/></a>';
var div4 = document.createElement('div');
div4.id = popUpId+'_content';
div4.className = npClass;
div4.style.position = 'relative';
div4.style.padding = '0px 30px 0px 12px';
div2.appendChild(div4);
div1.appendChild(div2);
div1.appendChild(div3);
$j('wrapper').appendChild(div1);
div4.style.minHeight = h + 'px';
div2.style.width  = w + 'px';
div1.style.width  = div2.offsetWidth + 'px';
var x = ($j('wrapper').offsetWidth - div1.offsetWidth) /2 ;
var y = 100 + getPageOffset().y;
$style(popUpId).left = ((npPosX!=-1) ? npPosX : x) + 'px';
$style(popUpId).top  = ((npPosY!=-1) ? npPosY : y) + 'px';
$style(popUpId).display = 'block';
}
function closeNormalPopUp() {
if(window.onCloseNormalPopUp){
onCloseNormalPopUp();
}
if($j('_normalPopUp')){
$style('_normalPopUp').display = 'none';
$j('_normalPopUp_content').innerHTML = '';
}
try {
$j('wrapper').removeChild($j('_normalPopUp'));
}
catch(e){
}
hidePageBlocker();
}
/**
* SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
*
* SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*/
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16.push(key+"="+_18[key]);}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();if(!(navigator.plugins && navigator.mimeTypes.length)) window[this.getAttribute('id')] = document.getElementById(this.getAttribute('id'));return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}return _23;};deconcept.PlayerVersion=function(_27){this.major=_27[0]!=null?parseInt(_27[0]):0;this.minor=_27[1]!=null?parseInt(_27[1]):0;this.rev=_27[2]!=null?parseInt(_27[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_29){var q=document.location.search||document.location.hash;if(q){var _2b=q.substring(1).split("&");for(var i=0;i<_2b.length;i++){if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){return _2b[i].substring((_2b[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2d=document.getElementsByTagName("OBJECT");for(var i=_2d.length;i>0;i--){_2d[i].style.display="none";for(var x in _2d[i]){if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);}if(Array.prototype.push==null){Array.prototype.push=function(_30){this[this.length]=_30;return this.length;};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;function onInitialize()
{
if(window.fbUpdate)
{
fbUpdate();
}
if($j('txtGreeting')) {
$j('txtGreeting').onclick = function()
{
$j('msgGreeting').value = $j('txtGreeting').innerHTML;
$style('txtGreeting').display = 'none';
$style('msgGreeting').display = 'block';
$j('msgGreeting').focus();
$j('msgGreeting').select();
};
$j('txtUrl').onclick = function()
{
$j('url').value = $j('txtUrl').innerHTML;
$style('txtUrl').display = 'none';
$style('url').display = 'block';
$j('url').focus();
$j('url').select();
};
$j('msgGreeting').onblur = function(){
$j('txtGreeting').innerHTML = $j('msgGreeting').value;
if($j('msgGreeting').value=='')
$j('txtGreeting').innerHTML = $j('msgGreeting').getAttribute('oValue');
$style('msgGreeting').display = 'none';
$style('txtGreeting').display = 'block';
updateProfileInfo();
}
$j('url').onblur = function(){
$j('txtUrl').innerHTML = $j('url').value;
if($j('url').value=='')
$j('txtUrl').innerHTML = $j('url').getAttribute('oValue');
$style('url').display = 'none';
$style('txtUrl').display = 'block';
updateProfileInfo();
}
getScriptsList();
getPhotoList();
getMusicList();
getLookingForFund();
getAwardPressList();
getBlogPostList();
}
}
function updateProfileInfo()
{
var form = document.forms['frmProfileInfo'];
if(form.elements['msgGreeting'].value == form.elements['msgGreeting'].getAttribute('oValue')){
form.elements['msgGreeting'].value = '';
}
if(form.elements['url'].value == form.elements['url'].getAttribute('oValue')){
form.elements['url'].value = '';
}
$.post('/ajax/updateProfileInfo.php', $(form).serialize(), function(data) {}, 'json');
}
function updateUserPhoto(location){
$j('userPhoto').src = '/showImage.php?type=user_photo&filename='+location;
}
function showUploadUserPhoto()
{
sendNotification("showUploadUserPhotoDialog");
}
function showUploadBio()
{
var id  = 'dlgUploadBio';
var url = 'filmedia/uploadBio.php';
var title = 'YOUR BIO / RESUME:';
if(!dialogPopUps[id]){
dialogPopUps[id] = new PopUpDialog(id, title, url, 570,328);
dialogPopUps[id].remoteServer = false;
dialogPopUps[id].offsetX = 34;
dialogPopUps[id].remoteServer = false;
}
dialogPopUps[id].title = title;
dialogPopUps[id].show();
}
function showUserBioMessage(msg)
{
showNormalPopUp('',420,300);
if($j('userBio')){
$j('_normalPopUp_content').innerHTML = $j('userBio').innerHTML;
}
else {
$j('_normalPopUp_content').innerHTML = msg;
}
}
function showExpress(editMode)
{
	sendNotification("showExpressDialog",{
		mode: (editMode==1 ? 'edit' :'normal'),
		uid: currentUserId
	});
}
function showLookingForFund()
{
sendNotification("showLookingForFundDialog");
}
function showUploadScripts()
{
	sendNotification("showUploadScriptsDialog");
}
function showUpdateAwards()
{
	sendNotification("showUpdateAwardsDialog");
}
function showBlogPost()
{
	sendNotification("showBlogPostDialog");
}
function showBlogPostEditor(postId)
{
	sendNotification("showBlogPostDialog", {
		mode: 'edit',
		postId: postId
	});
}
function showUploadPhotoMusic()
{
	sendNotification("showUploadPhotoMusicDialog");
}
function showUpdatePhotoMusic()
{
var id  = 'dlgUpdatePhotoMusic';
var url = 'filmedia/updatePhotoMusic.php';
var title = 'Stills / Photos / Music:';
if(!dialogPopUps[id]){
dialogPopUps[id] = new PopUpDialog(id, title, url, 824,730);
dialogPopUps[id].offsetX = 34;
dialogPopUps[id].remoteServer = false;
}
dialogPopUps[id].title = title;
dialogPopUps[id].show();
}
function showUpdateScripts()
{
var id  = 'dlgUpdateScripts';
var url = 'filmedia/updateScripts.php';
var title = 'Update Scripts / Synopsis:';
if(!dialogPopUps[id]){
dialogPopUps[id] = new PopUpDialog(id, title, url, 530,310);
dialogPopUps[id].offsetX = 34;
dialogPopUps[id].remoteServer = false;
}
dialogPopUps[id].title = title;
dialogPopUps[id].show();
}
function showUpdateProfile()
{
sendNotification("showUpdateProfileDialog");
}
function showFBUpdateProfile()
{
var id = 'dlgUpdateProfile';
var url = 'fbuserUpdateProfile.php';
var title = 'UPDATE INFO:';
if(!dialogPopUps[id]){
dialogPopUps[id] = new PopUpDialog(id, title, url, 429,270);
dialogPopUps[id].remoteServer = false;
dialogPopUps[id].offsetX = 50;
dialogPopUps[id].hideCloseButton = true;
}
dialogPopUps[id].title = title;
dialogPopUps[id].show();
}
function showEditFilmForm(){
var id  = 'dlgEditFilm';
var url = 'filmedia/editFilm.php';
var title = 'UPDATE YOUR FILM INFO:';
if(!dialogPopUps[id]){
dialogPopUps[id] = new PopUpDialog(id, title, url, 880,830);
dialogPopUps[id].remoteServer = false;
dialogPopUps[id].offsetX = 50;
}
dialogPopUps[id].title = title;
dialogPopUps[id].show();
}
function editExtraInfo(id,title)
{
$j('uExTitle').innerHTML = title.toUpperCase();
var form = document.forms['frmUserExInfo'];
if(form) {
form.elements['userExType'].value = id;
form.elements['userExContent'].value = '';
}
getUserExtraInfo(id);
return false;
}
function getUserExtraInfo(type)
{
var form = document.forms['frmUserExInfo'];
$.get( '/ajax/getUserExtraInfo.php', { uid : currentUserId, type : type },
function(data) {
if(form) {
form.elements['userExContent'].value = data;
}
var content = data !='' ? data :  '<span style="color:red">I am planning to update this section soon...</span>';
$('#infoEx').html(content);
}
);
}
function updateUserExtraInfo(form)
{
$.post( '/ajax/updateUserExtraInfo.php', $(form).serialize(), function(res){alert(res.message); }, 'json' );
return false;
}
function onSubmitFeedBack(form)
{
var defaultValue = form.feedbackContent.getAttribute('oValue');
if(form.feedbackContent.value == '' || form.feedbackContent.value==defaultValue){
alert('Please enter your feedback.');
}
else if(confirm('Are you sure you want to submit your feedback?')) {
$.post('/ajax/sumitFeedback.php', $(form).serialize(), function(res) { alert(res.message) }, 'json' );
}
}
function deleteBlogPost(id){
if(confirm('Are you sure want to delete this blog?')){
var _t = new Date().getTime();	
$.get('/ajax/deleteBlogPost.php?_='+_t, {id:id}, onGetBlogPostList, 'json');
}
}
var menuList = ['favorite','watchlater'];
var menuTimer;
var initMenu = false;
var currentMenuItem;
function setMenu(){
if(!initMenu){
var menuPos = $j('myFavoriteTab').getAttribute('menuPos');
var x = parseInt(menuPos)+5; //250;
for(var i=0;i<menuList.length;i++){
var type = menuList[i];
if(type=='favorite') {
$('#favoritemainmenu').css('marginLeft', x+'px');
$('#favoritesubmenu').css('marginLeft', (x+201) + 'px');
$j(type+'mainmenu').onmouseover = showFavoriteMenu;
$j(type+'submenu').onmouseover = showFavoriteMenu;
}
else if(type=='watchlater') {
$('#watchlatermainmenu').css('marginLeft', (x+169) + 'px');
$j('watchlatermainmenu').onmouseover = showWatchLaterMenu;
}
$j(type+'mainmenu').onmouseout = hideAllMenu;
if($j(type+'submenu')) {
$j(type+'submenu').onmouseout = hideAllMenu;
}
}
getWatchLaterPlaylist();
}
initMenu = true;
}
function showMenu(type) {
clearTimeout(menuTimer);
setMenu();
if(currentMenuItem!=type){
delayHideAllMenu();
currentMenuItem = type;
}
$style(type+'mainmenu').display = 'block';
}
function showFavoriteMenu(){
showMenu('favorite');
}
function showWatchLaterMenu(){
showMenu('watchlater');
}
function hideAllMenu(){
menuTimer = setTimeout('delayHideAllMenu()',500);
}
function delayHideAllMenu(){                                                                                                                                                                       
clearTimeout(menuTimer);
for(var i=0;i<menuList.length;i++){
var type = menuList[i];
if($j(type+'submenu'))
$style(type+'submenu').display = 'none';
if($j(type+'mainmenu'))
$style(type+'mainmenu').display = 'none';
}
}


function showPostProject(useRemote)
{
	sendNotification("showPostProjectDialog");
}

