var MSG_REQ_FIELD  = '%1 is a required field.';

function validateRequiredField(field, name)
{
 return validateRequiredField(field, name, '');
}

/** Validates required field */
function validateRequiredField(field, name, dv)
{
 //Try trim - will fail for input type="file".
 try
 {
 field.value = field.value.trim();
 dv = dv.trim();
 }
 catch(e) {}

 if (field.value.length == 0 || field.value == dv)
 {
 alert(MSG_REQ_FIELD.replace('%1', name));
 try{field.focus();}catch(e){}
 return false;
 }
 return true;
}
function $(id) {
 return document.getElementById(id);
};
var popup = null;
function setFocus(form,field)
{
 if (form != '') {
 try {document.forms[form][field].focus();} catch(e) {}
 }
 else {
 try {document.forms[0][field].focus();} catch(e) {}
 }
}
function addToCookieString(cookie,name,value)
 {
  cookie = cookie + name + '.' + value + '!'
 return cookie;
 }
 function getFromCookieString(cookie,name)
 {
  var values = cookie.split('!')

  for(var i=0;i < values.length;i++) {
     var c = values[i];

     c = c.split('.')

     if (c[0] == name)
      return c[1]


  }
  return '';
 }

function changeCookieString(cookie,name, value)
{
 var values = cookie.split('!');
 var ret = '';
 for(var i=0;i < values.length;i++) {
 var c = values[i];
 c = c.split('.');
 ret = ret + c[0] + '.';
 if (c[0] == name){
 c[1] == value; 
 }
 ret = ret + c[1] + '!';
 }
 alert (ret);
 return ret;
}


function getCheckedValue(radioObj) {
 if(!radioObj)
 return "";
 var radioLength = radioObj.length;
 if(radioLength == undefined)
 if(radioObj.checked)
 return radioObj.value;
 else
 return "";
 for(var i = 0; i < radioLength; i++) {
 if(radioObj[i].checked) {
 return radioObj[i].value;
 }
 }
 return "";
}

function setCheckedValue(radioObj, newValue) {
 if(!radioObj)
 return;
 var radioLength = radioObj.length;
 if(radioLength == undefined) {
 radioObj.checked = (radioObj.value == newValue.toString());
 return;
 }
 for(var i = 0; i < radioLength; i++) {
 radioObj[i].checked = false;
 if(radioObj[i].value == newValue.toString()) {
 radioObj[i].checked = true;
 }
 }
}


function createCookie(name,value,days) {
 if (days) {
  var date = new Date();
  date.setTime(date.getTime()+(days*24*60*60*1000));
  var expires = "; expires="+date.toGMTString();
 }
 else var expires = "";
 
 // don't set expiry
 expires = "";
 document.cookie = name+"="+value+expires+"; 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 "";
}
function getXMLHTTP() { //fuction to return the xml http object
 var xmlhttp=false; 
 try{
 xmlhttp=new XMLHttpRequest();
 }
 catch(e) { 
 try{ 
 xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch(e){
 try{
 req = new ActiveXObject("Msxml2.XMLHTTP");
 }
 catch(e1){
  xmlhttp=false;
 }
 }
 }
 
 return xmlhttp;
 }
 


function getCountry(){
 var strURL = "location.php?sel=country";
 var req = getXMLHTTP();
 req.onreadystatechange = function(){
 if (req.readyState == 4){
 $('countrydivx').innerHTML = req.responseText;
 }
 }
 req.open ('GET', strURL, true);
 req.send(null);
}

function getState(postfix,countryId,stateId, cityId)
{ 
 if(!countryId) countryId=-1;
 if(!stateId) stateId=-1;
 if(!cityId) cityId=-1;
 
 var strURL="location.php?sel=state&country="+countryId+'&postfix='+postfix;
 var req = getXMLHTTP();
 if (req && countryId !="-1")
 {
 req.onreadystatechange = function()
 {
 if (req.readyState == 4)
 {
  // only if .OK.
 if (req.status == 200)
  {
  $('state'+postfix).innerHTML=req.responseText;
  } else {
  alert('There was a problem while using XMLHTTP:\n' + req.statusText);
  }
 }
 }
  req.open('GET', strURL, true);
  req.send(null);
 } else 
 $('state'+postfix).innerHTML='<select name="state0'+postfix+'" style="width: 250px;"> <option value="-1">Select State</option></select>';
}


function getCity(postfix,stateId)
{
 if(!stateId) stateId=-1;
 if(stateId==-1){
 $('city'+postfix).innerHTML='<select name="city0'+postfix+'" style="width: 250px;"> <option value="-1">Select City</option></select>';
 }else{
  var strURL='location.php?sel=city&state='+stateId+'&postfix='+postfix;
  var req = getXMLHTTP();
  if (req)
  {
  req.onreadystatechange = function()
  {
  if (req.readyState == 4) // only if .OK.
  {
  if (req.status == 200)
  {
  $('city'+postfix).innerHTML=req.responseText;
  } else {
   alert('There was a problem while using XMLHTTP:\n' + req.statusText);
  }
  }
  }
  req.open('GET', strURL, true);
  req.send(null);
  }
 }
}



function getMedia(divid,media,type,code,pic,autoplay){
 var ext=""; 
  if(autoplay && autoplay=="on") autoplay="true";
 else autoplay="false";
 $(divid).innerHTML='<noembed>Hello, you either have JavaScript turned off or an old version of Adobe Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Here</a></noembed><embed src="mediaplayer.swf" width="220" height="175" wmode="transparent" allowscriptaccess="always" allowfullscreen="false" autostart="'+autoplay+'" flashvars="autostart='+autoplay+'&wmode=transparent&linkfromdisplay=true&lightcolor=0x335500&height=175&width=220&file='+code+ext+'&image='+pic+'&id=banner"/>';

}
 function onEnter( evt)
         {
          var keyCode = null;

          if( evt.which )
          {
          keyCode = evt.which;
          }
          else if( evt.keyCode )
          {
          keyCode = evt.keyCode;
          }

          if( 13 == keyCode )
          {
          return true;
          }

          return false;
         }


function getXMLHTTP() { //fuction to return the xml http object
 var xmlhttp=false;
 try{
 xmlhttp=new XMLHttpRequest();
 }
 catch(e) {
 try{
 xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch(e){
 try{
 req = new ActiveXObject("Msxml2.XMLHTTP");
 }
 catch(e1){
 xmlhttp=false;
 }
 }
 }

 return xmlhttp;
}


function getGenres(i){
 var strURL = "genre.php?i=" + i;
 var xmlHTTP = getXMLHTTP();
 xmlHTTP.onreadystatechange = function() {
 if (xmlHTTP.readyState == 4){
 $('genre' + i).innerHTML = xmlHTTP.responseText;
 } else {
 //alert ('There was an problem while using AJAX: \n' + xmlHTTP.statusText);
 }
 }
 xmlHTTP.open ( 'GET', strURL, true );
 xmlHTTP.send(null);
}

function rate(url){
 if (login == '1'){
 var xmlHTTP = getXMLHTTP();
 xmlHTTP.onreadystatechange = function() {
 if (xmlHTTP.readyState == 4){
 //alert(xmlHTTP.responseText);
 window.location = window.location.href;
 } else {
 //alert ('There was an problem while using AJAX: \n' + xmlHTTP.statusText);
 }
 }
 xmlHTTP.open ( 'GET', url + "&redir=" + window.location + "&loggedin=true", true );
 xmlHTTP.send(null);
 } else {
 showboxuser(url + "&redir=" + window.location);
 }
}

function initializeLoginBox(){
 if(userboxloaded==0) {
        userboxloaded=1;
	$('showuser').innerHTML=userbox;

 }
 $("userlogin_label").style.color = '#01a7d0';
 $("userjoin_label").style.color = '#01a7d0';
 $("userforgotpw_label").style.color = '#01a7d0';
 $("contact_label").style.color = '#01a7d0';
 $("userbox_remember").style.display = 'none';
 $("userbox_mobi").style.display = 'none';
 $("userbox_username").style.display='none';
 $("userbox_password").style.display = 'none';
 $("userbox_password1").style.display = 'none';
 $("userbox_login").style.display = 'none';
 $("userbox_email").style.display = 'none';
 $("userbox_join").style.display = 'none';
 $("userbox_forgotpw").style.display = 'none';
 $("userbox_tandc").style.display = 'none';
 $("userbox_or").style.display = 'none';
 $("userbox_em").style.display = 'none';
 $("verification").style.display = 'none';
 $("userbox_em1").style.display = 'none';
 $("contactmessage").style.display = 'none';
 $("contact_send").style.display = 'none';
 


 crossobj=ns6? $("showuser") : document.all.showuser
 if (ie4||ns6)
 {
 if (crossobj.style.visibility == "visible")
 {
  try
 {
 $("s_username").focus();
 $("s_username").select();
 }
 catch(ex)
 {
 }
 }

 }
 else if (ns4)
 {
 if (document.showuser.visibility == "visible")
 {
 try
 {
 $("s_username").select();
 }
 catch(ex)
 {
 }

 }
 }

}

function loginBoxChoose(item){
 initializeLoginBox();
 $('loginmessage').innerHTML=message;
 $(item+"_label").style.color ='red';
 $("seo").style.display = 'inline';
 $("overwrite2").style.display = 'inline';
 if(item=='userlogin'){

 $("userbox_remember").style.display = 'inline';
 $("userbox_password").style.display = 'inline';
 $("userbox_username").style.display = 'inline';
 $("userbox_login").style.display = 'inline';
 } else if(item=='userjoin'){

 $("userbox_username").style.display = 'inline';
 $("userbox_remember").style.display = 'inline';
 $("userbox_password").style.display = 'inline';
 $("userbox_password1").style.display = 'inline';
 $("userbox_email").style.display = 'inline';
 $("userbox_join").style.display = 'inline';
 $("userbox_tandc").style.display = 'inline';
 $("verification").style.display = 'inline';
 //$("userbox_mobi").style.display = 'inline';
 $("overwrite2").style.display = 'none';
 } else if(item=='userforgotpw'){

 $("userbox_email").style.display = 'inline';
 $("userbox_forgotpw").style.display = 'inline';
 $("userbox_or").style.display = 'inline';
 $("userbox_em").style.display = 'inline';
 $("userbox_em1").style.display = 'inline';
 $("userbox_mobi").style.display = 'inline';
 $("verification").style.display = 'inline';
 $("seo").style.display = 'none';
 $("overwrite2").style.display = 'none';
 } else if (item == 'contact'){

 $("contactmessage").style.display = 'inline';
 $("userbox_email").style.display = 'inline';
 $("userbox_mobi").style.display = 'inline';
 $("userbox_email").style.display = 'inline';
 $("userbox_em").style.display = 'inline';
 $("userbox_em1").style.display = 'inline';
 $("userbox_or").style.display = 'inline';
 $("contact_send").style.display = 'inline';
 $("seo").style.display = 'none';
 //$("mobiphone").focus();
 } 
}

function setUsername(username){
 if($('muser').checked==false && username != ''){
 $('username').value=username;
 }
}

function genre_direct(genre1,genre2,genre3){
 if(!genre1) genre1='0';
 if(!genre2) genre2='0';
 if(!genre3) genre3='0';

 $("genresearch").style.color = 'red';

 showboxgenre();

 document.search.genre1.value=genre1;
 document.search.genre2.value=genre2;
 document.search.genre3.value=genre3;
 document.search.minterests.checked=true;
 document.search.genre1.focus();
 //gotopage();
}
function location_direct(country,state,city){
 if(!country) country='-1' ;
 if(!state) state='-1';
 if(!city) city='-1';

 $("locationsearch").style.color = 'red';

 showboxlocation();

 if(!document.search.country0divx.value || document.search.country0divx.value != country){
  document.search.country0divx.value=country;
 getState('divx',country,state,city);
 }else if(!document.search.state0divx.value || document.search.state0divx.value !=state){
 document.search.state0divx.value=state;
  getCity('divx',country,state,city);
 }else{
 document.search.city0divx.value=city;
 }
 document.search.country0divx.focus();
 document.search.mlocation.checked=true;
 //gotopage();
}

function geturi(loc,id){
 var s=loc.match('(?:\\?|\&)'+id+'=([^\&]*)');
 return s?unescape(s[1].replace(/\+/g," ")):''
}

function forwardpage(topage,maxpage,destination){
 if(topage > maxpage){
 topage=maxpage;
 }
 if (topage < 1)
 topage = 1;
 if (!destination) destination = returnDocument();
 var start = (topage - 1) * limit;
 setStartCookie(start);
 var query = readCookie('lastQuery');
 document.search.action = destination + "?" + query + "&start=" + start;
 window.location = destination + "?" + query + "&start=" + start;
}

function eraseCookie(name) {
 createCookie(name,"",-1);
}
function gotourl(url){
 clearSearch();
 gotopage(false,false,false,url);

}
function setStartCookie(start){
 createCookie('start', start, 0);
}
function setLastQueryCookie(query){
 createCookie('lastQuery', query, 0);
}
function setHeaderParamsCookie(params){
 createCookie('header', params, 0);
}
function isContentPHP(){
 var currpage = returnDocument();
 if (currpage == "video.php" || currpage == "musicplay.php" || currpage == "pic.php" || currpage == "website.php" || currpage == "new.php" || currpage == "blog.php" || currpage == "upload.php" || currpage == "profile.php" || currpage=="event.php" || currpage == 'feed.php')
 return true;
 return false;
}

function clearSearch(){
 clearAll();
 document.search.query.focus();
 document.search.username.value="";



}

function item_checked(featured,interests,location,network,user,favorite){
 var mycheck= new String();
 mycheck=(featured.checked) ? '1': '0' ;
 mycheck=mycheck+ '_';
 mycheck=(interests.checked) ? mycheck+'1': mycheck+'0';
 mycheck=mycheck+ '_';
 mycheck=(location.checked) ? mycheck+'1': mycheck+'0';
 mycheck=mycheck+ '_';
 mycheck=(network.checked) ? mycheck+'1': mycheck+'0';
  mycheck=mycheck+ '_';
 mycheck=(user.checked) ? mycheck+'1': mycheck+'0';
  mycheck=mycheck+ '_';
 mycheck=(favorite.checked) ? mycheck+'1': mycheck+'0';
 return mycheck;




}
function item_read(itemck,readvar){

 var items = new Array();
 items['featured']=0;
 items['interests']=1;
 items['location']=2;
 items['network']=3;
 items['user']=4;
 items['favorite']=5;
 var result;
 if (itemck) {
 var pairs = itemck.split('_');
 result=pairs[items[readvar]];
 }
 if(result =='1') return true;
 else return false;
}
function clearAll(){
 eraseCookie('muser');
 eraseCookie('username');
 eraseCookie('lastQuery');
 eraseCookie('start');
 eraseCookie('header');
 eraseCookie('searchgenres');
 eraseCookie('searchlocation');
 eraseCookie('home');
 eraseCookie('redirect');
 eraseCookie('action');
 $("mnetwork").checked = false;
 $("minterests").checked = false;
 $("mfeatured").checked = false;
 $("muser").checked = false;
 $("query").value ="";
 $("sortval").value = "relevance";
 $("timeline").value = "0";
 $("mlocation").checked = false;
 $("mfavorite").checked = false;
 document.search.content[0].checked=true;
 hidboxgenre();
 hidboxlocation();
 hidboxuser();
 searchselcolor();

}
function userjoin(){
  showboxuser();
 loginBoxChoose('userjoin');
}

function contact () {
  showboxuser();
 loginBoxChoose('contact');
 $("mobiphone").focus();
} 

function relatesearch(title){
 clearAll();
 gotopage(null,null,null,null,unescape(title));

}

function gotouri(uri){
 createCookie('return',window.location,0);
 window.location=uri;
}

function returnDocument() {
 var file_name = document.location.href;
 if (file_name){
 var end = (file_name.indexOf("?") == -1) ? file_name.length : file_name.indexOf("?");
 return file_name.substring(file_name.lastIndexOf("/")+1, end);
 } else return "";
}

function get_destination(){
 var destination;
 if ($("page").value == "Music")
 destination='./music.php';
 else if ($("page").value == "Videos")
 destination='./videos.php';
 else if ($("page").value == "Events")
 destination='./events.php';
 else if ($("page").value == "Members")
 destination='./members.php';
 else if ($("page").value == "Pics")
 destination='./pics.php';
 else if ($("page").value == "News")
 destination='./news.php';
 else if ($("page").value == "Websites")
 destination='./websites.php';
 else if ($("page").value == "Blogs")
 destination='./blogs.php';
 else if ($("page").value == "Feeds")
 destination='./feeds.php';
 else if(document.search.muser.checked==true) 
 destination='./home.php';
 else if ($("page").value == "All")
 destination='./';
 else 
 destination=window.location.href.replace(/\?.*/g, '');
 return destination;
}



function genreSearch(){
 var query = getHeaderParams();
 var demographic = '';
 var genre = '';
 if (document.search.mlocation.checked){
 demographic = "demographic=" + readCookie('searchlocation');
 }
 if (document.search.minterests.checked){
 genre = "genre=" + document.search.genre1.value+'-'+document.search.genre2.value+'-'+document.search.genre3.value;
 }
 if (query == ''){
 if (demographic == ''){
 if (genre != ''){
 query = genre;
 }
 } else {
 if (genre != ''){
 query = genre + '&' + demographic;
 } else {
 query = demographic;
 }
 }
 } else {
 if (demographic == ''){
 if (genre != ''){
 query = query + '&' + genre;
 }
 } else {
 if (genre != ''){
 query = query + '&' + genre + "&" + demographic;
 } else {
 query = query + "&" + demographic;
 }
 }
 }

 createCookie('searchgenres', document.search.genre1.value+'-'+document.search.genre2.value+'-'+document.search.genre3.value, 0);

 setLastQueryCookie(query);
 destination = get_destination();
 document.search.action = destination + "?" + query;
 document.forms['search'].submit();


}
function locationSearch(){
 var query = getHeaderParams();
 var demographic = '';
 var genre = '';
 if (document.search.mlocation.checked){
 demographic = "demographic=" + document.search.country0divx.value + '_' + ((document.search.state0divx.value == "Select State") ? "-1" : document.search.state0divx.value) + '_' + ((document.search.city0divx.value == "Select City") ? "-1" : document.search.city0divx.value) ;
 }
 if (document.search.minterests.checked){
 genre = "genre=" + readCookie('searchgenres');
 }

 if (query == ''){
 if (genre == ''){
 if (demographic != ''){
 query = demographic;
 }
 } else {
 if (demographic != ''){
 query = genre + '&' + demographic;
 } else {
 query = genre;
 }
 }
 } else {
 if (genre == ''){
 if (demographic != ''){
 query = query + '&' + demographic;
 }
 } else {
 if (demographic != ''){
 query = query + '&' + genre + '&' + demographic;
 } else {
 query = query + "&" + genre;
 }
 }
 }


 createCookie('searchlocation', document.search.country0divx.value + '_' + ((document.search.state0divx.value == "Select State") ? "-1" : document.search.state0divx.value) + '_' + ((document.search.city0divx.value == "Select City") ? "-1" : document.search.city0divx.value), 0);

 setLastQueryCookie(query);
 destination = get_destination();
 document.search.action = destination + "?" + query;
 document.forms['search'].submit();


}

function featuredClick(){
 var query = getHeaderParams();
 if (document.search.mlocation.checked)
  query = query + "&demographic=" + readCookie('searchlocation');
 if (document.search.minterests.checked)
 query = query + "&genre=" + readCookie('searchgenres');

 setLastQueryCookie(query);
 setHeaderParamsCookie(query.replace(/.*\\?query=[^&]*&/, ''));
 destination = get_destination();
 if (query == ""){
 document.search.action = destination;
 } else {
 document.search.action = destination + "?" + query;
 }
 document.forms['search'].submit();

}

function getHeaderParams(){
 var query = "";
 if (document.search.query.value != ""){
 query = document.search.query.value;
 query = query.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
 query = "query=" + escape (query);
 if (document.search.sortval.value != 'relevance'){
 query = query + "&sortval=" + document.search.sortval.value;
 }
 } else {
 if (document.search.sortval.value != 'relevance'){
 query = "sortval=" + document.search.sortval.value;
 }
 }

 if (getCheckedValue(document.search.content) != ""){
 if (query == ""){
 query = "content=" + getCheckedValue(document.search.content);
 } else {
 query = query + "&content=" + getCheckedValue(document.search.content);
 }
 }
 if (document.search.mfeatured.checked){
 if (query == ""){
 query = "featured=true";
 } else {
 query = query + "&featured=true";
 }
 }
 if (document.search.mfavorite.checked){
 if (query == ""){
 query = "bookmark=true";
 } else {
 query = query + "&bookmark=true";
 }
 }
 if (document.search.mnetwork.checked){
 if (query == ""){
 query = "network=true";
 } else {
 query = query + "&network=true";
 }
 }
 if (document.search.timeline.value != '0'){
 if (query == ""){
 query = "timeline=" + document.search.timeline.value;
 } else {
 query = query + "&timeline=" + document.search.timeline.value;
 }
 }
 if (document.search.muser.checked){
 if (query == ""){
 query = "user=" + document.search.username.value;
 } else {
 query = query + "&user=" + document.search.username.value;
 }
 }

 return query;

}

function createQuery(){
 var query = getHeaderParams();
 var genres = readCookie('searchgenres') != '' ? readCookie('searchgenres') : "0-0-0";
 var demographic = readCookie('searchlocation') != '' ? readCookie('searchlocation') : "-1_-1_-1";
 if (document.search.mlocation.checked)
  query = query + "&demographic=" + demographic;
 if (document.search.minterests.checked)
  query = query + "&genre=" + genres;

 return query;
}



function setfocus()
{
 if (location.pathname=="/members.php" )
 $("page").value = "Members";
 else if (location.pathname=="/music.php" || location.pathname=="/musicplay.php")
 $("page").value = "Music";
 else if (location.pathname=="/videos.php" || location.pathname=="/video.php")
 $("page").value = "Videos";
 else if (location.pathname=="/pics.php" || location.pathname=="/pic.php")
 $("page").value = "Pics";
 else if (location.pathname=="/events.php" || location.pathname=="/event.php")
 $("page").value = "Events";
 else if (location.pathname=="/news.php" || location.pathname=="/new.php")
 $("page").value = "News";
 else if (location.pathname=="/websites.php" || location.pathname=="/website.php")
 $("page").value = "Websites";
 else if (location.pathname=="/blog.php" || location.pathname=="/blogs.php")
 $("page").value = "Blogs";
 else if (location.pathname=="/feed.php" || location.pathname=="/feeds.php")
 $("page").value = "Feeds";
 else
 $("page").value = "All";
 if(document.search.query.value !="") document.search.query.select();
 else document.search.query.focus();
}

function isEnter(evt){

 var keyCode = null;
          if( evt.which )
          {
          keyCode = evt.which;
          }
          else if( evt.keyCode )
          {
          keyCode = evt.keyCode;
          }

          if( 13 == keyCode )
          {
          return true;
          }
          return false;

}
function join(){
 var str=document.search.mail.value;
 var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
 if(document.search.s_username.value.length <1 || document.search.s_username.value.length >64){
 alert('Username must be between 1 and 64 characters');
 }
 else if(document.search.s_password.value.length <5){
 alert('Invalid password (less than 5 character)');
 }
 else if(document.search.s_password.value != document.search.s_password1.value){
 alert('Password does not match');
 }else if (str !='' && (str.indexOf(at)==-1 || (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) || (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) || (str.indexOf(at,(lat+1))!=-1) || (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) || (str.indexOf(dot,(lat+2))==-1) || (str.indexOf(" ")!=-1))){
 alert('Invalid email entered');
 }else if(!document.search.privacy_policy.checked){
 alert('You must agree to our terms and conditions to join');
 }else if(document.search.vericode.value.length != 5){
 alert('Verification code is 5 alpha numeric charaters');
 } else gotopage(0,'join');
}

function send(){
 var str=document.search.mail.value;
 var phone = document.search.mobiphone.value;
 var at="@";
 var dot=".";
 var lat=str.indexOf(at);
 var lstr=str.length;
 var ldot=str.indexOf(dot);
 if (str == '' && phone == ''){
 alert ('Please enter either a phone number or an email address'); 
 } else {
 if (str !='' && (str.indexOf(at)==-1 || (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) || (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) || (str.indexOf(at,(lat+1))!=-1) || (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) || (str.indexOf(dot,(lat+2))==-1) || (str.indexOf(" ")!=-1))){
 alert('Invalid email entered');
 } else {
 gotopage(0, 'contact'); 
 }
 }
}


function forgotpw(){
  var str=document.search.mail.value;
  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
 if(document.search.s_username.value.length>0 && (document.search.s_username.value.length <1 || document.search.s_username.value.length >20)){
  alert('Username must be between 1 and 20 characters');
 }else if (str.length>0 &&(str.indexOf(at)==-1 || (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) || (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) || (str.indexOf(at,(lat+1))!=-1) || (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) || (str.indexOf(dot,(lat+2))==-1) || (str.indexOf(" ")!=-1))){
  alert('Invalid email entered');
 }else if(document.search.mobiphone.value.length==0 && str.length==0){
 alert('You must enter either cellphone or email');
 } else gotopage(0,'forgotpw');
}


function getParams() {
 var idx = document.URL.indexOf('?');
 var params = new Array();
 if (idx != -1) {
 var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
 for (var i=0; i<pairs.length; i++) {
 nameVal = pairs[i].split('=');
 params[nameVal[0]] = nameVal[1];
 }
 }
 return params;
}

function getFromLastQuery(needle){
 var str = readCookie('lastQuery');
 var pairs = str.split('&');
 for (var i = 0; i < pairs.length; i++){
 var val = pairs[i].split ('=');
 if (val[0] == needle)
 return val[1];
 }
 return "";
}

var userbox= '<div style="background-color:#000080; width:100%" id="dragbaruser" onMousedown="initializedraguser(event)"> <div style="float:left;"> <font style="font-weight:bold" face="Verdana" color="#ffffff"><small>UserPanel</small></font></div> <div style="float:right" > <a style="text-decoration:none; color:white" href="javascript: hidboxuser();">X</a> </div> <div style="clear:both"></div> </div> <div style="border: #000080 2px solid; background-color:white"> <div style="float: left; font-weight: bold"> <label id="userlogin_label" onClick="loginBoxChoose(\'userlogin\')">Login</label>'+
 '</div> <div style="float: left; padding-left: 10px;font-weight: bold"> <label id="userjoin_label" onClick="loginBoxChoose(\'userjoin\')" >Join Now</label> </div> <div style="float: left; padding-left: 10px;font-weight: bold"> <label id="userforgotpw_label" onClick="loginBoxChoose(\'userforgotpw\')">Forgot Password</label> </div> <div style="float: left; padding-left: 10px;font-weight: bold">'+
 '<label id="contact_label" onClick="loginBoxChoose(\'contact\')">Contact/Service</label> </div> <div style="clear:both"></div> <div style="color: red; text-align: left; font-weight:bold"><div id="loginmessage"></div><br> <br> </div> <div id="userbox_mobi" style="display: none"> <div style="float: left;"> Cellular: </div> <div style="float: left;padding-left:35px"> <input id=mobiphone name=mobiphone type="text" value="" size=10 style="width:80px;"> </div> <div style="clear:both"></div> </div> <div style="clear:both"></div> <div id=userbox_username style="display: none"> <div style="float: left;"> <font color="red">Username:</font> </div> <div style="float: left;padding-left:10px"> <input onFocus="this.select();" onKeyPress="if(isEnter(event)) gotopage(0,\'login\');" id=s_username name=s_username type="text" value=""> <br> (themusicage.com/username) </div> <div style="float: right;"> <span id="userbox_remember" style="display: none">'+
  '<input id="remember" name="remember" value="1" type="checkbox" '+remember_checked+'> Remember</span> </div> <div style="clear:both"><br> </div> </div> <div style="float:left" id="userbox_or">or<br> <br> </div> <div style="clear:both"></div> <div id="userbox_password" style="display: none"> <div style="float: left;"> <font color="red">Password:</font> </div> <div style="float: left; padding-left:18px"> <input onFocus="this.select();" onKeyPress="if(isEnter(event)) gotopage(0,\'login\');" id=s_password name=s_password type="password" value="" align="left">'+
 '</div> <div style="clear:both"></div> </div> <div id="userbox_password1" style="display: none"> <div style="float: left;"> <font color="red">Retype:</font> </div> <div style="float: left;padding-left:30px"> <input onKeyPress="if(isEnter(event)) gotopage(0,\'login\');" id=s_password1 name=s_password1 type="password" value="" align="left">'+
 '</div> <div style="clear:both"><br> </div> </div> <div id="userbox_email" style="display: none"> <div style="float:left; text-align:left" id="userbox_tandc"> <input name="privacy_policy" type="checkbox" value="true" id="agree" checked> <label for="agree">'+ l_i_agree+' <a href="#" onClick="javascript:OpenWindow(\''+url_tmpl_main+'popup/term_cond.html\',\'700\',\'400\');">Terms</a></label>&nbsp;|&nbsp;<a href="#" onClick="javascript:OpenWindow(\''+url_tmpl_main+'popup/priv_policy.html\',\'700\',\'400\',\'yes\');">Privacy</a></div> <div style="clear:both"></div> <div style="float: left; display:none" id="userbox_em"> Email:</div> <div style="float: left; padding-left:45px; display:none" id="userbox_em1"> <input id=mail name=mail type="text" value="" size=32> </div> </div> <div style="clear:both"><br> </div> <div id="verification"> <div style="float: left"> <font color="red">Verification:</font> </div> <div style="float: left; padding-left:10px"> <input id="vericode" name="vericode" value="" style="width:50px"> <img src="verifyimage.php" alt="Image verification" > <font size=-5>(case sensitive)</font> </div> <div style="clear:both"><br> </div> </div> <div id="contactmessage" style="display:none; text-align:left;"> <div style="float:left">Message</div> <textarea name="cmessage" id="cmessage" cols="15" rows="3" class="noMCE" style="width:220px"></textarea> <div style="clear:both"><br><br></div> <div style="text-align:left;"> <font color="red" style="font-weight:bold">* Get Consultation on Gaining Traffic to your Website</font> </div> <div style="text-align:left;"> <font color="red" style="font-weight:bold">* Feature Content on Main Page</font> </div> <div style="text-align:left;"> <font color="red" style="font-weight:bold">* Buy Advertisement Links</font> </div> <div style="text-align:left;"> <font color="red" style="font-weight:bold">* Add Link through the Uploads and Comments</font> </div> </div> <div class="btn" id="userbox_forgotpw" style="display: none"><a class="btn" href="javascript: forgotpw();"><span>Send</span></a><br> <br> </div> <div class="btn" id="userbox_login" style="display: none"><br>'+
 '<a class="btn" href="javascript: gotopage(0,\'login\')"><span>Login</span></a><br> <br> </div> <br> <div class="btn" id="userbox_join" style="display: none"><a class="btn" href="javascript: join();"><span>Join</span></a> <br> <br> <br> </div> <div class="btn" id="contact_send" style="display: none"><a class="btn" href="javascript: send();"><span>Send</span></a> <br> <br> <br> </div> <div id="seo" style="display:inline; "> <font color="red">Search Engine Section </font>(<font color="green"><em>Optional</em></font> )<br> <br> <img alt="Search Engines Google Yahoo MSN" src="searchengines.jpg" width="336"><br> <br> <div style="padding-top:5px"> <div style="float:left" class="bold">Title:</div> <div style="float:left; padding-left:40px"> <input name="usertitle" id="usertitle" style="width:130px;margin-left:7px" > <div id="overwrite2" style="display:none; padding-left:25px"> <input name="overwrite" id="overwrite" type="checkbox" value="1" > Overwrite</div> </div> <br style="clear:both"> </div> <div> <div style="float:left" class="bold">Description:</div> <div style="float:left; padding-left:9px"> <textarea name="userdescription" id="userdescription" cols="15" rows="3" class="noMCE" style="width:130px"></textarea> </div> <br> <br style="clear:both"> <br> <a href="http://www.themusicage.com/Support"><img alt="Example of user indexed on Google" src="support.jpg"></a> </div> </div> <br> </div> ';
var userboxloaded=0;
function showboxuser(redirect){
 if(redirect) document.search.redirect.value=redirect;
 if(users==0){
 initializeLoginBox();
 loginBoxChoose('userlogin');
 crossobj = ns6 ? $("showuser") : document.all.showuser;
 if (ie4||ns6)
 crossobj.style.visibility="visible";
 else if (ns4)
 document.showuser.visibility="visible";
 box++;

 try{
 $("s_username").focus();
 $("s_username").select();
 }
 catch(ex){
 }
 }
 users++;
}

function saveclick(field){
 if(login !='1'){
 if($(field).checked==true){
  showboxuser();
 }else{
 hidboxuser();
 }
 }else{
 gotopage();
 }
}
function redirectlogin(url){
 if(login !='1'){
  showboxuser(url);
 }else gotopage(false,false,false,url);


}
function logout(){
 var currpage = returnDocument();
 if (currpage == 'upload.php' || currpage == 'profile.php' || currpage == ""){
 document.search.redirect.value = './';
 } else {
 document.search.redirect.value = "?" + readCookie('lastQuery');
 }
 gotopage(false,'logout');
}

function interestsupdate(click){

 $("minterests").checked=click;
 interestsclick();
}

function interestsclick(){
 searchselcolor();
 if($("minterests").checked==true) showboxgenre();
 else if(box==0) genreSearch();
 else hidboxgenre();
}

function getContentsPHP(p){
 if (p == 'pic.php') return 'pics.php';
 if (p == 'video.php') return 'videos.php';
 if (p == 'musicplay.php') return 'music.php';
 if (p == 'event.php') return 'events.php';
 if (p == 'blog.php') return 'blogs.php';
 if (p == 'website.php') return 'websites.php';
 if (p == 'new.php') return 'news.php';
 if (p == 'feed.php') return 'feeds.php';
 if (p == 'pic.php') return 'pics.php';
 if (p == 'videos.php') return 'videos.php';
 if (p == 'music.php') return 'music.php';
 if (p == 'events.php') return 'events.php';
 if (p == 'blogs.php') return 'blogs.php';
 if (p == 'websites.php') return 'websites.php';
 if (p == 'news.php') return 'news.php';
 if (p == 'feeds.php') return 'feeds.php';
 if (p == 'members.php') return 'members.php';
 return '/';
}

function gomemberhome(){
 var user = document.search.username.value;
 var query = readCookie('lastQuery');
 href = window.location.href.replace(/.*(\?|php)/, '').replace(/(\&user|user).*/, '').replace(/content.*/, '');
 if (user != "" && user != "Enter Username"){
 if (!isContentPHP()){
 if (href != ''){
 $('gohomeid').href = 'home.php?' + href + "&user=" + user;;
 } else {
 $('gohomeid').href = "./" + user;
 }
 } else {
 $('gohomeid').href = getContentsPHP(returnDocument()) + "?" + query + "&user=" + user;
 }
 } else {
 $('gohomeid').href = "javascript: gohome()";
 }
}

function goupload(){
 //if (login == "1"){
 window.location = "upload.php";
 //} else {
 // showboxuser('upload.php');
 //}
}

function goprofile(){
 if (login == "1"){
 window.location = "profile.php";
 } else {
 showboxuser('profile.php');
 }
}


function locationupdate(click){
 $("mlocation").checked=click;
 locationclick();
}

function locationclick(){
 searchselcolor();
 if($("mlocation").checked==true)
 showboxlocation();
 else if(box==0) locationSearch();
 else hidboxlocation();
}

function nfclick(item,username,page,clear){
 if(clear) clearAll();
 if(username) {
 document.search.username.value=username;
 $(item).checked=true;
 }
 if($(item).checked==true && $("muser").checked==false) {
 $("muser").checked=true;
 if(document.search.username.value=="Enter Username") {
 if(login=='1' && loginuser){
 document.search.username.value=loginuser;
 } else showboxuser();
 }

 }
 createCookie('muser', "1", 0);
 if(box==0) featuredClick();

}
function userboxclose(){
 if(login !='1'){
 if($('save_genres').checked==true){
 $('save_genres').checked=false;
  hidboxuser();
 }
 if($('save_location').checked==true){
  $('save_location').checked=false;
  hidboxuser();
 }
 if(document.search.username.value=="") document.search.username.value="Enter Username";
 }
 if(users >0){
 userupdate(logincheck);
 }

}
function topage(page,clear){
 if(clear) clearAll();
 gotopage(false,false,false,page);
}
function usersearch(evt,user,clear,page){
 var enterEvt=isEnter(evt);
 if(!evt || enterEvt){
 if(!evt || !enterEvt) document.search.username.value=user;
 if(document.search.username.value !='') {
 if(clear) clearAll();
 document.search.muser.checked=true ;
 gotopage(false,false,false,false,false,page);
 } else {
 document.search.username.value=username_l;
 userupdate(true);
 }
 createCookie('muser', '1', 0);
 }
}
var username_l;
function generateSearch(){
 query = getHeaderParams();
 params = getParams();
 genre = params['genre'] != undefined ? params['genre'] : "";
 demographic = params['demographic'] != undefined ? params['demographic'] : "";
 if (document.search.mlocation.checked){
 if (readCookie('searchlocation') != ''){
 query = query + "&demographic=" + readCookie('searchlocation') ;
 } else {
 query = query + demographic;
 }
 }
 if (document.search.minterests.checked){
 if (readCookie('searchgenres') != ''){
 query = query + "&genre=" + readCookie('searchgenres');
 } else {
 query = query + genre;
 }
 }
 url = window.location.href.replace(/\\?.*/, '');
 if (query == ''){
 $('searchbtn').href = getContentsPHP(returnDocument());
 } else {
 $('searchbtn').href = getContentsPHP(returnDocument()) + "?" + query;
 }
 if ($('muser').checked){
 $('searchbtn').href = "home.php?" + query;
 }
}

function generateNav(id, page){
 var lastquery = readCookie('lastQuery');
 if (isContentPHP()){
 if (lastquery.replace (/.*php/, '') == ''){
 if (returnDocument() == 'home.php'){
 $(id).href = page + "?" + getHeaderParams();
 } else {
 $(id).href = page;
 }
 } else {
 $(id).href = page + "?" + lastquery.replace(/&start.*/, '');
 }
 }
 else if (returnDocument() == ""){
 if (lastquery != ""){
 $(id).href = page + "?" + lastquery;
 } else {
 $(id).href = page;
 }
 }
 else{
 var q = window.location.href.replace(/.*\?/, '').replace(/&start.*/, '').replace(/.*php/, '').replace(/wv.*/, '');
 if (q == ""){
 $(id).href = page;
 } else {
 $(id).href = page + "?" + q;
 }
 }
}

function hidboxuser(){
 users--;
 users=0;
 if(users==0){
 crossobj=ns6? $("showuser") : document.all.showuser
 if (ie4||ns6)
 crossobj.style.visibility="hidden"
 else if (ns4)
 document.showuser.visibility="hide"
 if(box>0) box--;

 document.search.query.focus();
 eraseCookie('action');
 }
 document.search.redirect.value='';
 if (login != '1'){
 $('muser').checked = false;
 $('mfavorite').checked = false;
 $('mnetwork').checked = false;
 document.search.redirect.value = '';
 }
}

function hidboxemail(){
 $('emailbox').style.visibility = 'hidden';
}

function userupdate(click,page){
 $("muser").checked=click;
 userclick(page);

}
function userclick(page){
 if($("muser").checked==true) {
 createCookie('muser', "1", 0);
 createCookie('username', document.search.username.value, 0);
 if(document.search.username.value=="Enter Username" || document.search.username.value=="" ) {
 if(login=='1') {
  document.search.username.value=loginuser;
  gotopage(false,false,false,page);
 }
 else showboxuser(page);
 }
 else if(box==0) featuredClick();
 else hidboxuser();
 }
 else {
 createCookie('muser', "0", 0);
 eraseCookie('username');
 $("mnetwork").checked=false;
 $("mfavorite").checked=false;
 if(box==0) featuredClick();
 else hidboxuser();
 }
}
function searchselcolor()
{
 if($("minterests").checked==true)
 {
 $("genresearch").style.color = 'red';
 }
 else
 {
 $("genresearch").style.color = '#01a7d0';
 }
 if($("mfeatured").checked==true)
 {
  $("featuredsearch").style.color = 'red';
 }
 else
 {
  $("featuredsearch").style.color = 'black';
 }
 if($("mlocation").checked==true)
 {
  $("locationsearch").style.color = 'red';
 }
 else
 {
  $("locationsearch").style.color = '#01a7d0';
 }
 if($("mnetwork").checked==true)
 {
  $("networksearch").style.color = 'red';
 }
 else
 {
  $("networksearch").style.color = 'black';
 }
 if($("mfavorite").checked==true)
 {
  $("favoritesearch").style.color = 'red';
 }
 else
 {
  $("favoritesearch").style.color = 'black';
 }

}

function userloginsearch(evt,user,clear,page){
 if(login=='1'){
 usersearch(evt,user,clear,page);
 }else{
 logincheck=$('muser').checked;
 loginBoxChoose('userlogin');
 showboxuser();
 }

}

function setcolor(){
 if (location.pathname=="/members.php" )
 $("xxxmembers").style.color = "red";
 else if(location.pathname=="/home.php") 
 $("xxxhome").style.color = "red";
 else if (location.pathname=="/music.php" || location.pathname=="/musicplay.php")
 $("xxxmusic").style.color = "red";
 else if (location.pathname=="/videos.php" || location.pathname=="/video.php")
 $("xxxvideos").style.color = "red";
 else if (location.pathname=="/pics.php" || location.pathname=="/pic.php")
 $("xxxpics").style.color = "red";
 else if (location.pathname=="/events.php" || location.pathname=="/event.php")
 $("xxxevents").style.color = "red";
 else if (location.pathname=="/news.php" || location.pathname=="/new.php")
 $("xxxnews").style.color = "red";
 else if (location.pathname=="/websites.php" || location.pathname=="/website.php")
 $("xxxweb").style.color = "red";
 else if (location.pathname=="/feeds.php" || location.pathname=="/feed.php")
 $("xxxfeed").style.color = "red";
 else if (location.pathname=="/profile.php")
 $("xxxprofile").style.color = "red";
 
 else if (location.pathname=="/upload.php")
 $("xxxupload").style.color = "red";
 
 
 
 else if (location.pathname=="/blogs.php" || location.pathname=="/blog.php")
 $("xxxblogs").style.color = "red";




else $("xxxmain").style.color = "red";



         }

 function addMessage(username,msgtyp,subject,body)
   {
  if(login=='1'){
     document.search.message_subject.value=subject;
     document.search.message_body.value=body;
     document.search.message_user.value=username;
     setCheckedValue(document.search.message_type,msgtyp);
 }else{
  hidboxmessage();
  redirectlogin(window.location.href.replace(/\?.*/g, '')+'?message_user='+username+'&cmd=message&message_type='+msgtyp);
    }

   }
   function initSubject(){
    if(document.search.message_subject.value==messageSubject){
     document.search.message_subject.value="";
    }
   }
   function initMessage(){
    if(document.search.message_body.value==messageBody){
     document.search.message_body.value="";
    }
   }
 function submitMessage(){
 document.forms['search'].action='?cmd=message';
 document.forms['search'].submit0.value="1";
 document.forms['search'].submit();
 //gotopage(null,'message',null,'-1');
 }

    function OpenWindow( sUri, iWidth, iHeight )
    {
     var sWindowName = 'win' + Math.floor( Math.random()*1000 )
     var iRealWidth = iWidth ? iWidth : 600
     var iRealHeight = iHeight ? iHeight : screen.height - 300

     var iLeft = Math.round( (screen.width-iRealWidth)/2 )
     var iTop = Math.round( (screen.height-iRealHeight)/2 ) - 35

     var sWindowOptions = 'status=yes,menubar=no,toolbar=no'
     sWindowOptions += ',resizable=yes,scrollbars=yes,location=no'
     sWindowOptions += ',width=' + iRealWidth
     sWindowOptions += ',height=' + iRealHeight
     sWindowOptions += ',left=' + iLeft
     sWindowOptions += ',top=' + iTop

     var oWindow = window.open( sUri, sWindowName, sWindowOptions )
     oWindow.focus()

     return oWindow;
 }


function hidboxmessage(){
crossobj=ns6? $("showmessage") : document.all.showmessage
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showmessage.visibility="hide"

document.search.query.focus();

}
function showboxmessage(username,msgtype){
crossobj=ns6? $("showmessage") : document.all.showmessage
if (ie4||ns6)
crossobj.style.visibility="visible"
else if (ns4)
document.showmessage.visibility="visible"
addMessage(username,msgtype,messageSubject,messageBody);
 if(login=='1'){
 document.search.message_subject.select();
 document.search.message_subject.focus();
 }
}

function hidboxgenre(){
crossobj=ns6? $("showgenre") : document.all.showgenre
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showgenre.visibility="hide"

if(box>0) box--;

document.search.query.focus();
}
function showboxgenre(){
crossobj=ns6? $("showgenre") : document.all.showgenre
if (ie4||ns6)
{
crossobj.style.visibility="visible"
}
else if (ns4)
document.showgenre.visibility="visible"
box++;
}


function initializedragsupport(e){
crossobj=ns6? $("showsupport") : document.all.showsupport
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbarsupport"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}
if (firedobj.id=="dragbarsupport"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

function hidsupport(){
crossobj=ns6? $("showsupport") : document.all.showsupport
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showsupport.visibility="hide"

if(box>0) box--;
sendEvent('playersupport','stop');
document.search.query.focus();
}


function hidboxlocation(){
crossobj=ns6? $("showlocation") : document.all.showlocation
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showlocation.visibility="hide"
if(box>0) box--;

document.search.query.focus();
}
function showboxlocation(){
crossobj=ns6? $("showlocation") : document.all.showlocation
if (ie4||ns6)
crossobj.style.visibility="visible"
else if (ns4)
document.showlocation.visibility="visible"
box++
}


//drag drop function for NS 4////
/////////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp
var box=0;
var users=0;
function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}
function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for ie4+ and NS6////
/////////////////////////////////


function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
return false
}
}
function initializedragmessage(e){
 crossobj=ns6? $("showmessage") : document.all.showmessage
 var firedobj=ns6? e.target : event.srcElement
 var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
 while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbarmessage"){
 firedobj=ns6? firedobj.parentNode : firedobj.parentElement
 }
 if (firedobj.id=="dragbarmessage"){
 offsetx=ie4? event.clientX : e.clientX
 offsety=ie4? event.clientY : e.clientY
 
 tempx=parseInt(crossobj.style.left)
 tempy=parseInt(crossobj.style.top)
 
 dragapproved=true
 document.onmousemove=drag_drop
 }
}

function initializedraggenre(e){
 crossobj=ns6? $("showgenre") : document.all.showgenre
 var firedobj=ns6? e.target : event.srcElement
 var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
 while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbargenre"){
 firedobj=ns6? firedobj.parentNode : firedobj.parentElement
 }
 if (firedobj.id=="dragbargenre"){
 offsetx=ie4? event.clientX : e.clientX
 offsety=ie4? event.clientY : e.clientY
 
 tempx=parseInt(crossobj.style.left)
 tempy=parseInt(crossobj.style.top)
 
 dragapproved=true
 document.onmousemove=drag_drop
 }
}
function initializedraglocation(e){
 crossobj=ns6? $("showlocation") : document.all.showlocation
 var firedobj=ns6? e.target : event.srcElement
 var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
 while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbarlocation"){
 firedobj=ns6? firedobj.parentNode : firedobj.parentElement
 }
 if (firedobj.id=="dragbarlocation"){
 offsetx=ie4? event.clientX : e.clientX
 offsety=ie4? event.clientY : e.clientY
 
 tempx=parseInt(crossobj.style.left)
 tempy=parseInt(crossobj.style.top)
 
 dragapproved=true
 document.onmousemove=drag_drop
 }
}
function initializedraguser(e){
 crossobj=ns6? $("showuser") : document.all.showuser
 var firedobj=ns6? e.target : event.srcElement
 var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
 while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbaruser"){
 firedobj=ns6? firedobj.parentNode : firedobj.parentElement
 }
 if (firedobj.id=="dragbaruser"){
 offsetx=ie4? event.clientX : e.clientX
 offsety=ie4? event.clientY : e.clientY
 
 tempx=parseInt(crossobj.style.left)
 tempy=parseInt(crossobj.style.top)
 
 dragapproved=true
 document.onmousemove=drag_drop
 }
}

function initializedragemail(e){
 crossobj=ns6? $("emailbox") : document.all.emailbox
 var firedobj=ns6? e.target : event.srcElement
 var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
 while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbaremail"){
 firedobj=ns6? firedobj.parentNode : firedobj.parentElement
 }
 if (firedobj.id=="dragbaremail"){
 offsetx=ie4? event.clientX : e.clientX
 offsety=ie4? event.clientY : e.clientY
 
 tempx=parseInt(crossobj.style.left)
 tempy=parseInt(crossobj.style.top)
 
 dragapproved=true
 document.onmousemove=drag_drop
 }
}

document.onmouseup=new Function("dragapproved=false")

////drag drop functions end here//////


function sendEvent(swf,typ,prm) {
 thisMovie(swf).sendEvent(typ,prm);
};
function getUpdate(typ,pr1,pr2,swf) {};
function thisMovie(swf) {
 // if(navigator.appName.indexOf("Microsoft") != -1) {
// return window[swf];
 //} else {
 return document[swf];
 //}
};

function getHTML(id, url) {
 var req = getXMLHTTP();
 req.onreadystatechange = function(){
  if (req.readyState == 4){
   $(id).innerHTML = req.responseText;
  }
 }
 req.open ('GET', url, true);
 req.send(null);
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
 if (restore) selObj.selectedIndex=0;
}
function gohome(){
 if (login == "1"){
  window.location = "./" + name_i;
 } else {
  showboxuser('home.php');
 }
}

function relatedClick(query) {
 eraseCookie('muser');
 document.search.muser.checked = false;
 createCookie('lastQuery', 'query=' + query, 0);
}
var mts;
function gotopage(lchoose,cmdz,page,topage,query,setpage,destination)
{
 if(!cmdz) cmdz='';
 regmts=RegExp(mts, "i");
 if(!document.search.query.value.match(regmts) && document.search.sortval.value=="top_keywords"){

  document.search.query.value+=" "+mts;
 }
 if(setpage) $("page").value=setpage;
 if(query) document.search.query.value=query.replace(/\//g," ");
 createCookie('return',window.location,0);

 setStartCookie(0);
 var query = createQuery();

 if(cmdz=='login' || cmdz=='join' || cmdz=='forgotpw' || cmdz == 'contact'){
  if(document.search.redirect.value !=""){
   createCookie('redirect',document.search.redirect.value,0);
  }else {
   createCookie('redirect',window.location.href,0);
  }
  //query = query + "&cmd=" + cmdz;
  createCookie('action', cmdz, 0);
 } else if (cmdz=='logout'){
  document.search.redirect.value = window.location.href;
  createCookie('action', cmdz, 0);
 }
 var setquery=1;
 document.forms['search'].submit0.value="0";
 if(topage) {
  query = readCookie('lastQuery');
  if (query == "")
   query = createQuery();
  setLastQueryCookie(query);
  if(topage=='-1'){
   document.forms['search'].submit();
  } else {
   destination=topage;
   setquery=0;
   if (destination.indexOf("?") == -1){
    if (query != ''){
     window.location = destination + "?" + query;
    } else {
     window.location = destination;
    }
   }
   else {
    if (query != ''){
     window.location = destination + "&" + query;
    } else {
     window.location = destination;
    }
   }
  }
 }else{
  setLastQueryCookie(query);
  if(!destination) destination = get_destination();
  if (query != ''){
   document.search.action = destination + "?" + query;
  } else {
   document.search.action = destination;
  }
  document.forms['search'].submit();
 }
}
var rating = new Array();
var url_tmpl_main;
var urating = new Array();
 function set_irating(type,x,y,z){
 var p1='r';
 var p2=rating[x];
 if(type=='user'){
 p1='ur';
 p2=urating[x];
 }
 var val= (z)?z:p2;
 if( $(p1+y+'img')){
 if(val>=y+0.25){
 if(val <y+0.75){
  $(p1+y+'img').src=url_tmpl_main+"img/rh.png";
 }else{
  $(p1+y+'img').src=url_tmpl_main+"img/r1.png";
 }


 }else{
 $(p1+y+'img').src=url_tmpl_main+"img/r0.png";
 }
 }
 }
function init_rating(type,num,val){
 set_irating(type,num,0,val);
 set_irating(type,num,1,val);
 set_irating(type,num,2,val);
}

 function set_irating2(type,x,y,z){
 var p1='r';
 var p2=rating[x];
 if(type=='user'){
 p1='ur';
 p2=urating[x];
 }
 var val= (z)?z:p2;
 if(val>=y+0.25){
 if(val <y+0.75){

  $(p1+y+'img'+x).src=url_tmpl_main+"img/rh.png";
 }else{
  $(p1+y+'img'+x).src=url_tmpl_main+"img/r1.png";
 }

 }else{
 $(p1+y+'img'+x).src=url_tmpl_main+"img/r0.png";
 }
 }
function init_rating2(type,num,val){
 set_irating2(type,num,0,val);
 set_irating2(type,num,1,val);
 set_irating2(type,num,2,val);
}
var login;
var limit=12;
var loginuser;
var name_i;
var logincheck=false;
var messageSubject="subject...";
 var messageBody="body..";
 
//var bookmarkURL = '<script type="text/javascript">var addthis_pub="musicage";</script><a style="text-decoration:none" href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, \'\', \'[URL]\', \'[TITLE]\')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img alt="Bookmark URL" src="http://s7.addthis.com/static/btn/sm-plus.gif" width="16" height="16" border="0" style="border:0"> URL</a><script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script><a style="text-decoration:none" href="http://www.addthis.com/feed.php?pub=musicage&amp;h1={rss_feedicon}" target="_blank"><img alt="Bookmark Feeds" src="http://s7.addthis.com/static/btn/sm-plus.gif" width="16" height="16" border="0" style="border:0"> Feed</a>';

var date_range=' <select id="timeline" name="timeline" onchange="gotopage(1);"> <option value="0">All Time</option> <option value="90">90 Days</option> <option value="60">60 Days</option> <option value="30">30 Days</option> </select>';
var sort_option=' <select id="sortval" name="sortval" onchange="gotopage(1);" > <option value="relevance">Relevance</option> <option value="random">Random</option> <option value="most_popular">Most Popular</option> <option value="top_commented">Top Comments</option> <option value="top_emailed">Top Email</option> <option value="top_flagged">Most Controversial</option> <option value="top_rated">Top Rating</option> <option value="most_searched">Most Searched</option> <option value="top_voted">Most Voted</option> <option value="top_viewed">Most Views</option> <option value="recently_bookmarked">Now Popular</option> <option value="recently_commented">Recent Comments</option> <option value="recently_rated">Latest Ratings</option> <option value="recently_viewed">New Views</option> <option value="recently_voted">New Voting</option> <option value="recently_searched">Latest Search</option> <option value="recently_updated">New Update</option> <option value="recently_created">New Upload</option> </select>';
var table_name=' <select style="margin:0" name="page" id="page" onchange="gotopage(1);"> <option value="All">All</option> <option value="Videos">Videos</option> <option value="Music">Music</option> <option value="Events">Events</option> <option value="Members">People</option> <option value="Pics">Pics</option> <option value="News">News</option> <option value="Blogs">Blogs</option> <option value="Websites">Web</option> <option value="Feeds">Feeds</option> </select>';
var genre1=' Keyword: <select name="genre1" style="width:200px;" onmouseover="getGenres(1)"> <option value=0>Select...</option> </select>';
var genre2=' Keyword: <select name="genre2" style="width:200px;" onmouseover="getGenres(2)"> <option value=0>Select...</option> </select> ';
var genre3=' Keyword: <select name="genre3" style="width:200px;" onmouseover="getGenres(3)"> <option value=0>Select...</option> </select>';

function setEnd(){

var isContent = isContentPHP();
var params = getParams();
var cmdz= params['cmd'];
var content = (isContent) ? ((getFromLastQuery('content') != "") ? getFromLastQuery('content') : "") : (params['content'] != undefined ? params['content'] : "");


var p = returnDocument();
if (params['user'] != undefined){
 createCookie('username', params['user'], 0);
}
if (p == "upload.php" || p == "profile.php"){
 eraseCookie('muser');
 $('muser').checked = false;
 document.search.username.value = name_i;
} else if (isContent) {
 document.search.username.value = readCookie('username');
} else {
 document.search.username.value = (params['user'] == undefined) ? "" : params['user'];
}

document.search.redirect.value = readCookie("redirect");
$("mnetwork").checked = (isContent) ? ((getFromLastQuery('network') == "true") ? true : (params['network'] == "true") ? true : false) : (params['network'] == "true") ? true : false;
if ($('mnetwork').checked == true){
 $('muser').checked = true;
}
$("minterests").checked = (isContent) ? ((getFromLastQuery('genre') != "") ? true : false) : (params['genre'] != undefined) ? true : false;
$("mfavorite").checked = (isContent) ? ((getFromLastQuery('bookmark') == "true") ? true : false) : (params['bookmark'] == "true") ? true : false;
$("mlocation").checked = (isContent) ? ((getFromLastQuery('demographic') != "") ? true : false) : (params['demographic'] != undefined) ? true : false;
$("muser").checked = (isContent) ? (getFromLastQuery('user') != "" ? true : ((params['user'] != undefined) ? true : false) ) : (params['user'] != undefined) ? true : false;
$("mfeatured").checked = (isContent) ? ((getFromLastQuery('featured') == "true") ? true : false) : (params['featured'] == "true") ? true : false;

$("query").value = (isContent) ? unescape(getFromLastQuery('query')) : (params['query'] != undefined ? unescape(params['query']) : "");

if(params['cmd'] && params['cmd']=='message' && params['type'] != 'clear' ) {
 showboxmessage(params['message_user'],params['message_type']);
}

if (p == 'home.php'){
 createCookie('home', '1', 0);
} else if (p == 'index.php' || p == '' || p == 'members.php' || p == 'music.php' || p == 'videos.php' || p == 'pics.php' || p == 'events.php' || p == 'news.php' || p == 'blogs.php' || p == 'websites.php' || p == 'feeds.php'){
 createCookie('home', '0', 0);
}


// set content
if(content) {
 setCheckedValue(document.search.content,content);
}
 // End -->

searchselcolor();
document.search.query.focus();
var reqlogin=params['login'];
if(reqlogin && reqlogin=='1'){
 redirectlogin(params['redirect']);
}

if ($('muser').checked == true){
 document.search.username.style.background = "yellow";
}

createCookie ('return', window.location, 0);

eraseCookie('return');
if(login=='1'){
 $("showlogout").style.display="inline";
}
if($("muser").checked==true && $("username").value=="Enter Username"){
 showboxuser();
}else if($("muser").checked==false && (location.pathname=='/' || location.pathname=='/index.php')){
  $("username").value="Enter Username";

}

if(readCookie('action') == 'join' && login==''){
 loginBoxChoose('userjoin');
 showboxuser(readCookie('redirect'));
}else if(readCookie('action') == 'login' && login==''){
 loginBoxChoose('userlogin');
 showboxuser(readCookie('redirect'));
}else if(readCookie('action')=='forgotpw'){
 loginBoxChoose('userforgotpw');
 showboxuser(readCookie('redirect'));
}else if(login==''){
 //loginBoxChoose('userlogin');

}





setcolor();
 //$('bookmarkURL').innerHTML=bookmarkURL;
 $('sort_option').innerHTML=sort_option;
 $('date_range').innerHTML=date_range;
 $('table_name').innerHTML=table_name;
 $('genre1').innerHTML=genre1;
 $('genre2').innerHTML=genre2;
 $('genre3').innerHTML=genre3;
var sortval = (isContent) ? ((getFromLastQuery('sortval') != "") ? getFromLastQuery('sortval') : "relevance") : (params['sortval'] != undefined ? params['sortval'] : "relevance");
var timeline = (isContent) ? ((getFromLastQuery('timeline') != "") ? getFromLastQuery('timeline') : '0') : (params['timeline'] != undefined ? params['timeline'] : '0');
// set sortval
if(sortval == "relevance" || sortval == "random" || sortval == "top_keywords" || sortval == "most_searched" || sortval == "most_popular" || sortval == "top_voted" || sortval == "top_rated" || sortval == "top_viewed" || sortval == "top_commented" || sortval == "top_emailed" || sortval == "top_flagged" || sortval == "recently_updated" || sortval == "recently_created" || sortval == "recently_viewed" || sortval == "recently_rated" || sortval == "recently_commented" || sortval == "recently_voted" || sortval == "recently_searched" || sortval == "recently_bookmarked") {
 $("sortval").value= sortval;
} else {
 $("sortval").value = "relevance";
}
if (timeline == "30" || timeline == "60" || timeline == "90" || timeline == "0") {
 $("timeline").value = timeline;
}
else {
 $("timeline").value = 0;
}
if (isContent){
 setHeaderParamsCookie(getHeaderParams().replace(/.*\\?query=[^&]*&/, '').replace(/query.*/, ''));
} else {
 var header = window.location.href.replace(/.*\\?query=[^&]*&/, '');
 header = header.replace(/.*\//, '').replace(/.*\?/, '').replace(/^&/, '').replace(/.*php/, '').replace(/wv.*/, '').replace(/query.*/, '').replace(/start.*/, '');
 setHeaderParamsCookie(header);
 setLastQueryCookie(window.location.href.replace(/.*\//, '').replace(/.*\?/, '').replace(/.*php/, ''));
}

setfocus();

}
var url_main, surl, username_l, gohometitle, gohomehref, rss_feed, addthis_pub, rss_feedicon,username,navmain, navmembers,navmusic, navvideos,navpics, navevents, navnews, navblogs, navwebsites, navfeeds, namejbar, namej, l_logout, main_message, save_genres, c_username, remember_checked, c_password,l_i_agree, url_tmpl_main,save_location,name,message;
function getMainForm(){
var form= '<form style="margin-bottom: 0;margin-top:2px" id="search" name="search" method="post" action="">'+
 '<input name="redirect" type="hidden">'+
 '<input name="pass" type="hidden">'+
 '<input name="submit0" type="hidden" value="0">'+
 '<input name="g1" type="hidden">'+
 '<input name="g2" type="hidden">'+
 '<input name="g3" type="hidden">'+
 '<input name="loc1" type="hidden">'+
 '<input name="loc2" type="hidden">'+
 '<input name="loc3" type="hidden">'+
 '<div style="text-align: left; background-color:white; width: 100%; height:100%;">'+
 '<div style="float: left;">'+
 '<a onFocus="if(this.blur)this.blur()" href="'+url_main+'"><img src="/_themes/main/TMA/img/tma.gif" border=0 alt="TheMusicAge.com (TMA)"></a> </div>'+
 '<div style="float: right;padding-left:2px;"><a style="margin:0" id="searchbtn" class="btn" href="" onmouseover="generateSearch();"><span>Search</span></a>&nbsp;&nbsp; <a style="margin:0;font-size:18px;text-decoration:none" onclick="clearAll();" href="'+url_main+surl+'"><span>x</span></a> </div>'+
 '<div id="date_range" style="float: right;padding-left:2px;margin-top:2px;">'+
 '</div>'+
 '<div id="sort_option" style="float: right;padding-left:2px;margin-top:2px;">'+
 '</div>'+
 '<div id="table_name" style="float: right;padding-left:2px;margin-top:2px;">'+
 '</div>'+
 '<div style="float: right;margin-top:1px;">'+
 '<input name="query" type="text" id="query" size=32 onkeypress="if(isEnter(event)) gotopage()" >'+
 '</div>'+
 '<div style="clear:right">'+
 '</div>'+
 '<div style="float: left; margin-left: 30px; font-size:-2;">'+
 '<div> <font style="color: red"><label>Search:</label></font>'+
 '<input type="checkbox" name="mfeatured" value="0" id="mfeatured" onclick="featuredClick();">'+
 '<span id="featuredsearch">Featured</span>'+
 '<input type="checkbox" name="minterests" value="1" id="minterests" onclick="interestsclick();">'+
 '<a id="genresearch" style="text-decoration: none; font-size: 1em" href="javascript: genre_direct(document.search.genre1.value,document.search.genre2.value,document.search.genre3.value)">Keyword</a>'+
 '<input type="checkbox" name="mlocation" value="1" id="mlocation" onclick="locationclick();">'+
 '<a id="locationsearch" style="text-decoration: none; font-size: 1em" href="javascript: location_direct(document.search.country0divx.value,document.search.state0divx.value,document.search.city0divx.value);">Location</a> </div>'+
 '<div> <font style="color: red">Content:</font>'+
 '<input type="radio" name="content" value="" checked onclick="featuredClick();">'+
 'All'+
 '<input type="radio" name="content" value="computer" onclick="featuredClick();">'+
 'Online'+
 '<input type="radio" name="content" value="mobile" onclick="featuredClick();">'+
 'Mobile </div>'+
 '</div>'+
 '<div style="margin-left:640px">'+
 '<div>'+
 '<input type="checkbox" name="mfavorite" value="1" id="mfavorite" onClick="nfclick(\'mfavorite\');">'+
 '<span id="favoritesearch">Bookmarks</span> </div>'+
 '<div>'+
 '<input type="checkbox" name="mnetwork" value="1" id="mnetwork" onClick="nfclick(\'mnetwork\');">'+
 '<span id="networksearch">Network</span>'+
 ' <input type="checkbox" name="muser" id="muser" value="1" onclick="userclick();">'+
 '<input name="username" style="border-style:inset; border-width:1px; font-size:x-small; color: red" type="text" id="username" size=22 onkeypress="usersearch(event)" onclick="this.value=\'\'" value="'+username_l+'">'+
 '<a style="text-decoration: none" id="gohomeid" href="'+gohomehref+'" onmouseover="gomemberhome()"><img height=15px width=15px src="/_files/home.ico" border=0 title="User search" alt="User search" ></a> </div>'+
 '</div>'+
 '<div style="clear:both"></div>'+
 '<div style="clear:both"></div> <div style="text-align: center; color: red; font-weight:bold">'+main_message+'</div> </div>'+
 '<div id="showgenre" class="popup" style="width:280px;left:500px;top:100px;"> <div class="popupdrag" id="dragbargenre" onMousedown="initializedraggenre(event)">'+
 '<div style="float:left;"> <font style="font-weight:bold" face="Verdana" color="#ffffff"><small>Select 3 keywords</small></font></div> <div style="float:right" ><a style="text-decoration:none; color:white" href="#" onClick="interestsupdate(false); return false">X</a></div>'+
 '<div style="clear:both"></div> </div> <div class="popupbody"> <!-- PUT YOUR CONTENT BETWEEN HERE --> <br> <div id="genre1" style="margin:0; padding:0; width:100%"> </div> <div id="genre2" style="margin:0; padding:0; width:100%"> </div> <div id="genre3" style="margin:0; padding:0; width:100%"> </div> <br> <div style="float:left; color:red">&nbsp;<small>Add<br> <i>Keyword</i>:</small></div> <input style="width:195px;" id="requestgenre" name="requestgenre"> <br> <br> <div style="clear: both; padding-left:40px;" class="btn"><a class="btn" href="javascript: genreSearch()"><span>Search</span></a></div> <span id="showsavegenres"> <input type="checkbox" name=save_genres value="1" onclick="saveclick(\'save_genres\');" id="save_genres"'+ save_genres+'> Save</span> <br>'+
 '<br> <!-- END YOUR CONTENT HERE --> </div> </div> <div id="showmessage" class="popup" style="width:340px;left:400px;top:200px;" > <div class="popupdrag" id="dragbarmessage" onMousedown="initializedragmessage(event)"> <div style="float:left;"> <font style="font-weight:bold" face="Verdana" color="#ffffff"><small>Contact User</small></font> </div> <div style="float: right;"> <a style="text-decoration:none; color:white" href="#" onClick="hidboxmessage(); return false">X</a> </div> <div style="clear: both"></div> </div> <div class="popupbody"> <div style="float: left"> <input type=text size=20 name=message_user> </div> <div style="float: right"> <input type=radio name=message_type value="email"> Email <input type=radio name=message_type value="text"> Text </div> <div style="clear: both"> <br> </div> <input name="message_subject" size="50" maxlength="50" onclick="initSubject()"> <textarea name="message_body" rows="8" cols="38" onclick="initMessage()" onfocus="this.select();"></textarea> <a class="btn" href="javascript: submitMessage()" ><span>Send</span></a> <br> <br> <br> </div> </div>'+
  '<div id="showuser" class="popup" style="width:340px;left:400px;top:15px;"></div> '+'<div id="showlocation" class="popup" style="width:310px;left:500px;top:100px;"> <div class="popupdrag" id="dragbarlocation" onMousedown="initializedraglocation(event)"> <div style="float:left;"> <font style="font-weight:bold" face="Verdana" color="#ffffff"><small>Choose your location</small></font></div> <div style="float:right" ><a style="text-decoration:none; color:white" href="#" onClick="locationupdate(false); return false">X</a></div> <div style="clear:both"></div> </div> <div class="popupbody"> <br> <div style="float:left"> Country: </div> <div style="float:right" id="countrydivx"> <select style="width: 250px;" name="country0divx" id="country" onmouseover="getCountry()"> <option value="-1">Select Country</option>'+
 '</select> </div> <div style="clear:both; padding-top:2px"></div> <div style="float:left"> State: </div> <div style="float: right" id="statedivx"> <select name="state0divx" style="width: 250px;" id="state" onmouseover="getState(\'divx\', document.forms[\'search\'].country0divx.value)" > <option value="-1">Select State</option> </select> </div> <div style="clear:both; padding-top:2px"></div> <div style="float:left"> City: </div> <div style="float: right" id="citydivx"> <select name="city0divx" id="city" style="width: 250px;" > <option value="-1">Select City</option> </select> </div> <div style="clear:both;"><br> </div> <div style="padding-left:55px;" class="btn"><a class="btn" href="javascript: locationSearch()"><span>Search</span></a></div> <span style="display: inline" id="showsavelocation"> <input type="checkbox" name=save_location value="1" id=save_location onclick="saveclick(\'save_location\');"'+ save_location+'> Save </span> <br> <br> </div> </div> </form>';

return form;
}

/*function getLoginForm(){

var form= '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr style="background-color:#01A7D0;color:white"><td><div id="menul" style="width:100%;text-align:center"><a id="xxxmain" href="'+navmain+'" >MAIN</a><a id="xxxmembers" href="'+navmembers+'" >PEOPLE</a><a id="xxxmusic" href="'+navmusic+'" >MUSIC</a><a id="xxxvideos" href="'+navvideos+'" >VIDEOS</a><a id="xxxpics" href="'+navpics+'" >PICS</a><a id="xxxevents" href="'+navevents+'" >EVENTS</a><a id="xxxnews" href="'+navnews+'" >NEWS</a><a id="xxxblogs" href="'+navblogs+'" >BLOGS</a><a id="xxxweb" href="'+navwebsites+'" >WEB</a><a id="xxxfeed" href="'+navfeeds+'" >FEEDS</a></div></td><td style="text-align:right;padding-right:9px"><div id="menur" style="width:100%">'+
 '<a href="javascript: userloginsearch(false,\''+name+'\',true) " style="color: red" >'+name+'</a>'+namejbar+'<a style="color: red" href="javascript: userjoin()" >'+ namej +'</a><br>'+
  '<a style="text-decoration: none" href="javascript: gohome();"><span id="xxxhome">home</span></a> | <a style="text-decoration: none" href="javascript: goupload()"><span id="xxxupload">upload</span></a> | <span style="text-decoration: none; display:inline" id="showprofile"> <a style="text-decoration: none" href="javascript: goprofile()"><span id="xxxprofile">profile</span></a> | </span><a href="javascript: contact(); ">contact</a><span id="showlogout" style="display: none;"> | <a style="text-decoration: none" href="javascript: logout()">'+l_logout+'</a> </span>' +
 '</div></td></tr></table>'

return form;
}*/

function getLoginForm(){

var form= '<a href="javascript: userloginsearch(false,\''+name+'\',true) " style="color: red" >'+name+'</a>'+namejbar+'<a style="color: red" href="javascript: userjoin()" >'+ namej +'</a><br>'+
  '<a style="text-decoration: none" href="javascript: gohome();"><span id="xxxhome">home</span></a> | <a style="text-decoration: none" href="javascript: goupload()"><span id="xxxupload">upload</span></a> | <span style="text-decoration: none; display:inline" id="showprofile"> <a style="text-decoration: none" href="javascript: goprofile()"><span id="xxxprofile">profile</span></a> | </span><a href="javascript: contact(); ">contact</a><span id="showlogout" style="display: none;"> | <a style="text-decoration: none" href="javascript: logout()">'+l_logout+'</a> </span>'

return form;
}

function addThisForm(){
var form = '<a style="text-decoration:none" href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, \'\', \'[URL]\', \'[TITLE]\')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img alt="'+meta_tooltip+' Add Url" src="http://s7.addthis.com/static/btn/sm-plus.gif" width="16" height="16" border="0" style="border:0"> URL</a>'+
 '&nbsp;<a style="text-decoration:none" href="http://www.addthis.com/feed.php?pub=musicage&amp;h1='+rss_feedicon+'" target="_blank"><img alt="'+meta_tooltip+' Add Feed" src="http://s7.addthis.com/static/btn/sm-plus.gif" width="16" height="16" border="0" style="border:0"> Feed</a>'
return form;
}

function display_network(display){createCookie('network_display',display,0);gotopage();}var nd=readCookie("network_display");eraseCookie("network_display");function email(id, user ){if (!user) user=false;var xmlHTTP=getXMLHTTP();xmlHTTP.onreadystatechange=function() {if (xmlHTTP.readyState==4){window.location=window.location.href;} else {}};email=document.getElementById('inviteemail');if (user){xmlHTTP.open ( 'GET', "email.php?page="+surl+"&ctable=user&id=" + id + "&addr=" + email.value + "&user=" + user, true );}else{xmlHTTP.open ( 'GET', "email.php?page="+surl+"&ctable="+ctable+"&id=" + id + "&addr=" + email.value + "&user=" + user, true );}xmlHTTP.send(null);hidboxemail()}function showboxemail(contentid, user ){if (!user) user=false;document.getElementById('emailbox').style.visibility='visible';document.getElementById('emaillink').href="javascript:email('" + contentid + "', " + user + ")";document.getElementById('inviteemail').focus();}
var memberStore={};
var last_user='';
function doProfileUser(username){
 $('profile').innerHTML=memberStore[username];
 init_rating('user',0);
}
function turnon(username) {
if(!username) return;
setUsername(username);
var ajaxObj;
if(last_user !=username && username){
 if(!ajaxObj) ajaxObj=getXMLHTTP();
 else if (ajaxObj.readyState !=0){ajaxObj.abort();}
 last_user=username;
 if(typeof(memberStore[username]) !="undefined"){
 doProfileUser(username);
 }else{
 
 document.getElementById('profile').innerHTML="<b>Loading....";
 var strURL="members_profile.php?username="+escape(username);
 ajaxObj.onreadystatechange=function(){
 if (ajaxObj.readyState==4){
 memberStore[username]=ajaxObj.responseText; 
 doProfileUser(username);}
 };
 ajaxObj.open ('GET', strURL, true);
 ajaxObj.send(null);
 
 }
}


if(login=='1'){ if(nd=="requests_made"){document.getElementById("network_decision_cancel"+x).style.display="inline";
} else if(nd=="requests_received"){document.getElementById("network_decision_choice"+x).style.display="inline";}}} 
function display_xxx(){
 if(document.getElementById("mfavorite").checked==false && document.getElementById("mnetwork").checked && login=='1' && document.getElementById('username').value==loginuser){document.getElementById("network_check").style.display="inline";} if(nd=="requests_made"){document.getElementById("network_requests_made").style.color="red";}else if(nd=="requests_received"){document.getElementById("network_requests_received").style.color="red";}else{document.getElementById("network_members").style.color="red";}
}
function outHTML(div){
var stat=' <table> <tr> <td colspan=5><span style="color:black;text-decoration:underline;font-weight:bold">SEARCH RESULTS</span> </tr> <tr> <td colspan=5><br></td> </tr> <tr> <td style="width:77px"><a style="text-decoration:none" href="'+url_main+'members.php?'+headerparams+'" >People</a></td> <td style="width:77px" align=right>'+user+'</td> <td style="width:77px"></td> <td style="width:77px"><a style="text-decoration:none" href="websites.php?'+headerparams+'" >Web</a></td> <td style="width:77px" align=right>'+website+'</td> </tr> <tr> <td style="width:77px"><a style="text-decoration:none" href="music.php?'+headerparams+'" >Music</a></td> <td style="width:77px" align=right>'+audio+'</td> <td style="width:77px"></td> <td style="width:77px"><a style="text-decoration:none" href="events.php?'+headerparams+'" >Event</a></td> <td style="width:77px" align=right>'+eventz+'</td> </tr> <tr> <td style="width:77px"><a style="text-decoration:none" href="videos.php?'+headerparams+'" >Videos</a></td> <td style="width:77px" align=right>'+video+'</td> <td style="width:77px"></td> <td style="width:77px"><a style="text-decoration:none" href="news.php?'+headerparams+'" >News</a></td> <td style="width:77px" align=right>'+news+'</td> </tr> <tr> <td style="width:77px"><a style="text-decoration:none" href="pics.php?'+headerparams+'" >Picture</a></td> <td style="width:77px" align=right>'+pic+'</td> <td style="width:77px"></td> <td style="width:77px"><a style="text-decoration:none" href="blogs.php?'+headerparams+'" >Blogs</a></td> <td style="width:77px" align=right>'+blog+'</td> </tr> <tr> <td style="width:77px"></td> <td style="width:77px"></td> <td style="width:77px"></td> <td style="width:77px"><a style="text-decoration:none" href="feeds.php?'+headerparams+'" >Feeds</a></td> <td style="width:77px" align=right>'+feed+'</td> </tr> <tr> <td colspan=5><br></td> </tr> <tr> <td colspan=5><a style="color:red;text-decoration:none;" href="members.php?user='+username+'&amp;network=true" onclick="document.getElementById(\'muser\').checked=true;createCookie(\'muser\', \'1\', 0)">SOCIAL NETWORK ('+network+')</a> </tr> <tr> <td style="width:77px"><a style="text-decoration:none" href="members.php?user='+username+'&amp;network=true">Requests</a></td> <td style="width:77px" align=right>'+network_requests+'</td> <td style="width:77px"></td> <td style="width:77px"><a style="text-decoration:none" href="members.php?user='+username+'&amp;network=true">Sent</a></td> <td style="width:77px" align=right>'+network_pending+'</td> </tr> <tr> <td colspan=5><br></td> </tr> <tr> <td colspan=3><a style="text-decoration:none;color:red" href="javascript:gohome(\'profile.php\',true);">Edit Profile</td> <td colspan=2><font style="font-weight:bold">Messages:</font> '+messages+' <a style="text-decoration:none" href="javascript:redirectlogin(\'home.php?cmd=message&amp;type=clear\');" onclick="return confirm(\'Are you sure you want to reset your message counter?\')">(Clear)</a></b></span></td> </tr></table>';

$(div).innerHTML=stat;
};
function getProfileUsername(username){
 var ajaxObj=getXMLHTTP();
 document.getElementById('userdiv').innerHTML="<b>Loading....";
 var strURL="profileuser.php?username="+username;
 ajaxObj.onreadystatechange=function(){
 if (ajaxObj.readyState==4){
 document.getElementById('userdiv').innerHTML=ajaxObj.responseText;
 init_rating2('user',0);
 }
 };
 ajaxObj.open ('GET', strURL, true);
 ajaxObj.send(null);
}

function rotate_adworker(adArray){
 var randNumber=Math.floor(Math.random()*1000)%adArray.length;
 $("advertising").innerHTML= adArray[randNumber];
}

function rotate_ad(){
 var adArray = new Array();
 adArray.push('<center><div style="font-size:1.3em; background-color:white; width:500px; height:125px; text-align:center; border: blue 1px solid;"><a target="_blank" rel="nofollow" style="text-decoration:none" href="http://www.musicinvideo.com"><img alt="Videos Advertising" style="border:0; width:500px; height:125px" src="/_themes/main/TMA/img/models.jpg" ></a></div></center>');
 rotate_adworker(adArray);
}
function getMarketingForm()
{
 return '<center><div style="font-size:1.3em; background-color:white; width:500px; height:125px; text-align:center; border: red 1px solid;"><ul><li><a href="javascript: userjoin();">Upload</a> Your Own Free <b>Landing Pages</b> Easily.</li><li>Get On <b>Search Engines</b> Like <font color="red">Google</font> Within 24 hours.</li><li>Contact <a href="javascript: contact(); ">support@themusicage.com</a> For A <b>Free Consultation</b>.</li></ul><br><a href="javascript: contact(); ">Advertise Here</a></div></center>';
}
function getAdvertisementForm()
{
 return '<center><div style="font-size:1.3em; background-color:white; width:500px; height:125px; text-align:center; border: red 2px solid;"><br><br><br><br><br><a href="javascript: contact(); ">Advertise Here</a></div></center>';
}


