function newWindow(mypage,myname,w,h,features) {
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{winl = 0;wint =0;}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
}
function flvPlayerExpand(name){
mydiv=document.getElementById(name);
myswf=document.getElementById(name+"-flv");
myswf.width='350';
myswf.height='290';
mydiv.setAttribute("class", "flvout")
}
function flvPlayerContract(name){
mydiv=document.getElementById(name);
myswf=document.getElementById(name+"-flv");
myswf.width='160';
myswf.height='120';
mydiv.setAttribute("class", "flv")
}
var wsurl = "http://ws.nudgem.com:8082/nudgeWS/Service1.svc/"
var mobile=false;
$(document).ready(function() {
$('#order').click(function() {
orderJob($('#moviename').val(), $('#message').val(), $('#mob').attr('checked'));
});
$('#zyntropics').click(function() {
orderJob('snowmancorporate', 'Jolly chatting with you '+ $('#userName').val()+'. Yikes! Now all the Elves want ' +$('#userElf').val(), 'false');
});
$('#kooladedemo').click(function() {
orderJob('kooladedemo', $('#canLabel').val()+'|' +$('#canMessage').val(), 'false');
});
$.ajaxSetup({
type: "GET",
contentType: "application/json; charset=utf-8",
dataType: "jsonp", //needed for remote access
success: function(data,status,xhr) {
alert("success " + data);
$("#output").html(data)
},
error: function(xhr, status, err) {
alert("error " + status);
},
complete: function(xhr, status) {
//do stuff
}
});
});
function loadDdl(ClientID){
$.ajax({
url: wsurl + "listMovies",
data: {clientID: ClientID},
dataType: "jsonp", //needed for remote access
success: function(data,status,xhr) {
$("#moviename").html('x');
$.each(data,function(i,fname) {
$("#moviename").append( $('').val(fname).html(fname));
});
}
});
}
function loadDdlFull(ClientID){
$.ajax({
url: wsurl + "pageMoviesInfo",
data: {clientID: ClientID, page: 1,pagesize: 20},
dataType: "jsonp", //needed for remote access
success: function(data,status,xhr) {
$("#moviename").html('x');
$.each(data,function(i,mov) {
$("#moviename").append( $('').val(mov.name).html(mov.friendlyname));
});
}
});
}
function loadThumbs(ClientID,firstpage,size,fmt){
if (fmt=="3GP"){mobile=true}
$.ajax({
url: wsurl + "pageMoviesInfo",
data: {clientID: ClientID, page: firstpage,pagesize: size},
dataType: "jsonp", //needed for remote access
success: function(data,status,xhr) {
$("#job").html('');
$.each(data,function(i,mov) {
$("#job").append( "
"+mov.name+" - "+mov.friendlyname);
$("#job").append( "
");
$("#job").append( " ");
$("#job").append( " ");
$("#job").append( " ");
$("#job").append( "");
$('#sub'+mov.name).click(function() { startJob(mov.name, $('#txt'+mov.name).val(),$('#oid'+mov.name).val(),$('#set'+mov.name).val()); });
});
}
});
}
function loadThumbscopy(ClientID,firstpage,size){
$.ajax({
url: wsurl + "pageMoviesInfo",
data: {clientID: ClientID, page: firstpage,pagesize: size},
dataType: "jsonp", //needed for remote access
success: function(data,status,xhr) {
$("#job").html('');
$.each(data,function(i,mov) {
$.each(mov.movieFormats,function(j,fmt) {
if (fmt.maxWords>0) limit=" max words="+fmt.maxWords+", max chars per word="+fmt.maxCharsPerWord;
else limit=" max characters="+fmt.maxChars;
$("#job").append( mov.name + " : "+fmt.name+limit + "
");
});
});
}
});
}
function loadRecent(){
$.ajax({
url: wsurl + "getRecentJobs",
data: {numfiles: 4},
dataType: "jsonp", //needed for remote access
success: function(data,status,xhr) {
$.each(data,function(i,job) {
if (job.completed) {
if ($.trim(job.message)=="gif"){
$("#flvs").append("

