var windowWidth = 0, windowHeight = 0; var pictureIDArray = new Array(); function submitForm(formID,onsucess){ var data = "{"; $.each($(formID).serializeArray(), function() { alert(this.name); data += this.name+':"'+this.val()+'"'; }); data += "}"; $.ajax({ type: 'POST', url: $(formID).href, data: data, success: onsuccess, dataType: dataType }); } function ajaxRequest(reqUrl,tab, contentDivID,append){ $("#"+contentDivID+" .more_button").hide(); if (!append){ $("#"+contentDivID).html('
Loading ...
'); } //$("#"+contentDivID).hide(); $.ajax({ url: reqUrl, cache: false, dataType: "html", divID: contentDivID, tabName: tab, success: ((!append)?loadRequestedContent:appendRequestedContent), complete: fadeInContentHolder }); } function fadeInContentHolder(content){ //$("#"+this.divID).fadeIn("slow"); } function ajaxXMLRequest(reqUrl,contentDivID, loadRequestedContent){ $.ajax({ url: reqUrl, cache: false, dataType: "xml", divID: contentDivID, success: loadRequestedContent }); } function floatingDiv(width,height,content,xPos,yPos){ // can calculate depending on the text lengthi var html= ''; html +='
'; html +='
'; html +='close
'; html += content; html +='
'; html +='
'; $('#floatingDiv').html(html); $('#floatingDiv').show(); } function closeFloatingDiv(){ $('#floatingDiv').fadeOut(); $('#floatingDiv').html(''); if ($('#shareContent')){ $('#shareContent').fadeOut(); //$('#shareContent').style.display = "none"; } } function divAlert(msg){ var height = 70; var charsPerLine = 40; if (msg.length > charsPerLine){ height += Math.ceil((msg.length/charsPerLine)*20); //50 chars per row = #rows * 15 } floatingDiv(320,height,msg); } function loadSwfInDiv(divID,swf){ if ($("#"+divID) != undefined){ $("#"+divID).html(swf); } } function setVisible(divID){ if ( $("#"+divID).style.display == "none"){ $("#"+divID).style.display = "block"; return true; } else { $("#"+divID).style.display = "none"; return false; } } function setDisplay(divID,value){ if ( $("#"+divID)){ $("#"+divID).style.display = value; } } function setWindowSize() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } windowWidth = myWidth; windowHeight = myHeight } ////////////// function deleteEntry(entID,entryDivID){ var url = "delete.php?id="+entID+"&rndnum="+Math.random(); var myQuery = new dbQuery(); myQuery.entryDivID = entryDivID; myQuery.requestData(url,this,"receiveDeleteEntry"); } function receiveDeleteEntry(query){ var myRecords = query.getRecords(); var recLength = myRecords.length; for (var i=0;i 0){ $("#"+query.entryDivID).style.borderWidth = 0; $("#"+query.entryDivID).html(''); //removeChild($("#"+query.entryDivID)); } removeObject(query); } function setTabsVisible(visible){ if (visible){ $('#fullMenu').style.display="block"; $('#shortMenu').style.display="none"; } else { $('#fullMenu').style.display="none"; $('#shortMenu').style.display="block"; } } //------ registration --------// function validateEmail(emailAddress) { var emailOK = true; var atCount = -1; currentPos = 0; while (currentPos != -1) { currentPos = emailAddress.indexOf('@',currentPos+1); atCount++; } if ((atCount > 1)||(atCount == 0)) { emailOK = false; } // are there any characters after the at sign? if (emailAddress.substr(emailAddress.indexOf("@")+1).length < 1) { emailOK = false; } // are there any '.'s after the at sign? if (emailAddress.substr(emailAddress.indexOf("@")+1).indexOf('.') == -1) { emailOK = false; } // can't end with dot if (emailAddress.substr(emailAddress.length - 1,1) == ".") { emailOK = false; } var badChars = new Array("^","!","#","%","$","&","*","+","/","=","?","{","}","|","~"); for (var i=0;i= 2){ //ajaxXMLRequest(url, box.id,receiveAutocomplete); $.ajax({ type: 'POST', url: baseUrl+"artist/autocomplete", data: {artistSearchString:box.value}, success: function (resp){ /*update the count*/ if (resp.success){ var artists = ""; $.each(resp.artists, function(key, value) { artists += '<' + value["Art_Name"]+'
'; artists += ""+value["Art_Name"]+"
"; }); $('#suggestionDiv').html("
"+artists+"
"); } }, dataType: "json" }); } } function fillSelected(box_id,value){ $("#"+box_id).val(value); $('#suggestionDiv').html(""); } function inArray(elem,array){ for (var i=0; i= 0) { res = parseInt(width.substring(0, p)); } else { //do not know how to calculate other //values (such as 0.5em or 0.1cm) correctly now //so just set the width to 1 pixel res = 1; } } return res; } //returns border width for some element function __getBorderWidth(element) { var res = new Object(); res.left = 0; res.top = 0; res.right = 0; res.bottom = 0; if (window.getComputedStyle) { //for Firefox var elStyle = window.getComputedStyle(element, null); res.left = parseInt(elStyle.borderLeftWidth.slice(0, -2)); res.top = parseInt(elStyle.borderTopWidth.slice(0, -2)); res.right = parseInt(elStyle.borderRightWidth.slice(0, -2)); res.bottom = parseInt(elStyle.borderBottomWidth.slice(0, -2)); } else { //for other browsers res.left = __parseBorderWidth(element.style.borderLeftWidth); res.top = __parseBorderWidth(element.style.borderTopWidth); res.right = __parseBorderWidth(element.style.borderRightWidth); res.bottom = __parseBorderWidth(element.style.borderBottomWidth); } return res; } //returns absolute position of some element within document function getElementAbsolutePos(element) { var res = new Object(); res.x = 0; res.y = 0; if (element !== null) { res.x = element.offsetLeft; res.y = element.offsetTop; var offsetParent = element.offsetParent; var parentNode = element.parentNode; var borderWidth = null; while (offsetParent != null) { res.x += offsetParent.offsetLeft; res.y += offsetParent.offsetTop; var parentTagName = offsetParent.tagName.toLowerCase(); if ((__isIE && parentTagName != "table") || (__isFireFoxNew && parentTagName == "td")) { borderWidth = __getBorderWidth(offsetParent); res.x += borderWidth.left; res.y += borderWidth.top; } if (offsetParent != document.body && offsetParent != document.documentElement) { res.x -= offsetParent.scrollLeft; res.y -= offsetParent.scrollTop; } //next lines are necessary to support FireFox problem with offsetParent if (!__isIE) { while (offsetParent != parentNode && parentNode !== null) { res.x -= parentNode.scrollLeft; res.y -= parentNode.scrollTop; if (__isFireFoxOld) { borderWidth = __getBorderWidth(parentNode); res.x += borderWidth.left; res.y += borderWidth.top; } parentNode = parentNode.parentNode; } } parentNode = offsetParent.parentNode; offsetParent = offsetParent.offsetParent; } } return res; } function requestHTMLContent(url,targetDIV,executeWhenLoaded){ if ($("#"+targetDIV) != null){ $("#"+targetDIV).html( "
"); } var myQuery = new dbQuery(); myQuery.targetDIV = targetDIV; myQuery.onLoadFunction = executeWhenLoaded; myQuery.requestData(url+"&rndnum="+Math.random(),this,"receiveHTMLContent"); } function receiveHTMLContent(query){ var myRecords = query.getRecords(); var recLength = myRecords.length; // var html = unescape(myRecords[1].getPropertyValue("content")); var html = (myRecords[1].getPropertyValue("content")); if ($("#"+query.targetDIV) != null){ $("#"+query.targetDIV).html( base64Decode(html)); } if (query.onLoadFunction){ query.onLoadFunction(); } // removeObject(query); } function updateStatus(box){ $.ajax({ type: 'POST', url: baseUrl+"/site/updateStatus/st", data: {status:$("#web_status").val()}, success: function (resp){ /*update the count*/ if (resp.success){ // $("#like_count_"+id).text(parseInt($("#like_count_"+id).text())+1); } else { divAlert(resp.msg); } }, dataType: "json" }); } function addResponseComment(form){ if (userID == ""){ divAlert("You have to be logged in to add comments.

Go To login
"); } else { floatingDiv(700,100,base64Decode(form),"10%","20%"); } } function setHide(hide,hideID,type){ var url = "tabs/"+type+"/hideWallEntry.php?hideID="+hideID+"&hide="+hide+"&rndnum="+Math.random(); window.location.href = url } function encode64(input) { var output = new StringMaker(); var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4)); } return output.toString(); } var enc64List, dec64List; function initBase64() { enc64List = new Array(); dec64List = new Array(); var i; for (i = 0; i < 26; i++) { enc64List[enc64List.length] = String.fromCharCode(65 + i); } for (i = 0; i < 26; i++) { enc64List[enc64List.length] = String.fromCharCode(97 + i); } for (i = 0; i < 10; i++) { enc64List[enc64List.length] = String.fromCharCode(48 + i); } enc64List[enc64List.length] = "+"; enc64List[enc64List.length] = "/"; for (i = 0; i < 128; i++) { dec64List[dec64List.length] = -1; } for (i = 0; i < 64; i++) { dec64List[enc64List[i].charCodeAt(0)] = i; } } // Self-initialize the global variables initBase64(); function base64Decode(str) { var c=0, d=0, e=0, f=0, i=0, n=0; var input = str.split(""); var output = ""; var ptr = 0; do { f = input[ptr++].charCodeAt(0); i = dec64List[f]; if ( f >= 0 && f < 128 && i != -1 ) { if ( n % 4 == 0 ) { c = i << 2; } else if ( n % 4 == 1 ) { c = c | ( i >> 4 ); d = ( i & 0x0000000F ) << 4; } else if ( n % 4 == 2 ) { d = d | ( i >> 2 ); e = ( i & 0x00000003 ) << 6; } else { e = e | i; } n++; if ( n % 4 == 0 ) { output += String.fromCharCode(c) + String.fromCharCode(d) + String.fromCharCode(e); } } } while (typeof input[ptr] != "undefined"); output += (n % 4 == 3) ? String.fromCharCode(c) + String.fromCharCode(d) : ((n % 4 == 2) ? String.fromCharCode(c) : ""); return output; } function responseBoxSelected(inputBox,divID,loggedIn){ if (loggedIn){ inputBox.value = ""; inputBox.style.color = "#000000"; inputBox.style.display = "block"; } else { window.location.href='loginForm.php?msg=You have to be logged in order to add comments.'; } } ////////////////----- // todo:replace url function showRadio(){ window.open ("http://www.soundtrapper.com/stRadio","radioPop","location=0,status=0,scrollbars=0,toolbar=0,menubar=0,width=500,height=143"); } function showSearch() { window.open ("http://www.soundtrapper.com/search.php","searchTool","location=0,status=0,scrollbars=0,toolbar=0,menubar=0,width=1200,height=755"); } function fadeInDiv(divID){ $("#"+divID).fadeIn("slow"); } function showResponses(divID){ $("#txt_"+divID).html('hide'); $("#"+divID).fadeIn("slow"); } function toggleResponses(divID){ if ($("#txt_"+divID).html() == 'view'){ $("#txt_"+divID).html('hide'); $("#"+divID).fadeIn("slow"); } else { $("#txt_"+divID).html('view'); $("#"+divID).hide(); } } function commentInputSelected(inputBox){ if (inputBox.value == "Write a comment ..."){ inputBox.value = ""; } } function executeYesFunction(stringFunction){ jQuery.globalEval(stringFunction); closeFloatingDiv(); } function confirmBox(question,yesFunction){ var msg=""+question+""; msg +="

     "; msg +="
"; floatingDiv(300,140,msg); } // user/artist // //------------ news feed actions ---------------// function setNewFeedActions(){ $(document).ready(function() { $(".like_btn").click( function () { // disable after click if (this.id != 0){ ajaxRequest('account/iLikeActivity.php?id='+this.id+'&rndnum='+Math.random(),"News Feed", "num_likes_"+this.id); this.id = 0; } }); $(".comment_btn").click( function () { $("#add_comment_"+this.id).show(); }); }); } function toggleTabNavigation(img){ if ($("#hiddenTabs").is(":visible")){ img.src = "images/new/white_triangle_down.png"; } else { img.src = "images/new/white_triangle_up.png"; } $("#hiddenTabs").slideToggle("slow"); } /* player */ function playTrack(audioID){ //$("#audio_player").html(''); // document.getElementById("mp3_player").play(); $("#control_btn_"+audioID).attr("src","images/new/player_pause.png"); //$(".player").play(); } //-------------- used in artist and user ---------------// function addWallComment(id){ var form = $("#comment_form_"+id); $.post(form.attr("action"), form.serialize(),function(data) { if (id == 0){ $(".new_comment_input").val(""); $("#comments_holder").prepend(data); } else { $("#"+id+"_children").append(data); $(".new_comment_input").val(""); $("#"+id+"_children").show("slow"); $("#view_hide_link_"+id).show("slow"); } }); } function deleteActivity(id){ $.ajax({ type: 'POST', url: baseUrl+"/activityWall/delete/"+id, data: {awID:id}, success: function (resp){ /*update the count*/ if (resp.success){ $("#activity_parent_"+id).hide('slow'); } else { divAlert(resp.msg); } }, dataType: "json" }); } function likeActivity(id){ $.ajax({ type: 'POST', url: baseUrl+"/activityWall/like/"+id, data: {awID:id}, success: function (resp){ /*update the count*/ if (resp.success){ $("#like_count_"+id).text(parseInt($("#like_count_"+id).text())+1); } else { divAlert(resp.msg); } }, dataType: "json" }); } function onLoadExec(){ }