﻿function openPlayer(url_add)
   {
   window.open(url_add,'welcome','width=410,height=518,menubar=no,status=no,location=no,toolbar=no,scrollbars=no')
   }
   
   
   function custVal_txt(source,args) {

   fsValid = true
  //  var myRegxp = /^[A-Za-zÀ-ÖØ-öø-ÿ '\-\.]{1,35}$/;

   // if (myRegxp.test(args.Value) == false) {
   //     fsValid = false
  //  }

    if (args.Value == ''  || args.Value == 'username'  || args.Value == 'password'  || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '2px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
     document.getElementById(source.controltovalidate).style.padding =  '1px';
        }

        args.IsValid = fsValid 
};

   function custVal_alphaNum(source,args) {

 
    if (args.Value == '') {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '2px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
     document.getElementById(source.controltovalidate).style.padding =  '1px';
        }

        args.IsValid = fsValid 
};



function custVal_email(source,args) {
 fsValid = true
    var myRegxp = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;

   if (myRegxp.test(args.Value) == false) {
        fsValid = false
  }

    if (args.Value == ''  || fsValid == false) {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}




function MM_showHideLayers() { //v6.0

document.getElementById('ctl00_UDBlogin').style.display = 'none';


}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function publishfeed(fieldname) {

// get the field details
var theval = document.getElementById(fieldname)

var template_data = {"name":theval.value,
"href": document.location.href,
"description":  theval.value 
}


FB.Connect.streamPublish('', template_data, '');


// FB.Connect.showFeedDialog(55488138062,template_data);

}

function publishnews(sTitle,sStory,sLink) {


var template_data = {"name":sTitle,
"href": sLink,
"description":  sStory
}


FB.Connect.streamPublish('New story on the Dead Town Radio website.', template_data, '', '', 'Post your comments:', '', '', '305254832494');


}

function publishaudio(sTitle,sThumb,sMp3Link) {

var template_data = {
	'name': sTitle + ' by Dead Town Radio',
	'href': 'http://www.deadtownradio.com/recordings.aspx',
	'caption': '{*actor*} is currently listening to ' + sTitle,
	'media':
  [{'type':   'mp3',
   'src':    sMp3Link,
   'title':  sTitle,
   'artist': 'Dead Town Radio',
   'album': 'Dead Town Radio'
   
   }]}

FB.Connect.streamPublish('Listen to ' + sTitle + ' by Dead Town Radio', template_data, '', '', 'Post your comments:', '', '', '305254832494');


}

function publishvideo(sTitle,sThumb,sVidLink) {

var template_data = {
	'name': sTitle + ' by Dead Town Radio',
	'href': 'http://www.youtube.com/watch?v=' + sVidLink ,
	'caption': 'Click to play',
	'media':
  [{'type':   'video',
   'video_src':  'http://www.youtube-nocookie.com/v/' + sVidLink + '&hl=en&fs=1&rel=0',
   'preview_img': sThumb,
   'video_title':sTitle
   
   }]}

FB.Connect.streamPublish('Watch ' + sTitle + ' by Dead Town Radio', template_data, '', '', 'Post your comments:', '', '', '305254832494');

}


function custVal_email(source,args) {
 fsValid = true
    var myRegxp = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;

   if (myRegxp.test(args.Value) == false) {
        fsValid = false
  }

    if (args.Value == '' || args.Value == 'you@here.co.uk' || fsValid == false) {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function PromptExtended() {
__doPostBack('ctl00$hdnbutton','')

//var myPermissions = "publish_stream"; // permissions your app needs

//FB.Connect.showPermissionDialog(myPermissions , function(perms) {
 /// if (!perms) 
 // {
    // handles if the user rejects the request for permissions. This is a good place to log off from Facebook connect
//  }
 // else
 // {
      // finish up here if the user has accepted permission request
 // };
//});


//FB.XFBML.Host.parseDomTree();

//window.location.reload();
}



