
function detectServVideo(url){var vidId;var varReturn=false;url=parseUrl(url);if(url!==false){if(url['domain'].indexOf('youtube.com')!==-1){vidId=getParamValue(url['query'],'v');if(vidId!==false){varReturn={'type':'youtube','obj':'flash','thumb':'http://img.youtube.com/vi/'+vidId+'/default.jpg','url':'http://www.youtube.com/v/'+vidId+'&rel=1','x':450,'y':370}}}
if(url['domain'].indexOf('metacafe.com')!==-1){vidId=url['path'].replace(/^\/watch\/([0-9]+)\/.*$/g,function(x,y){return y;});if(vidId!=url['path']){varReturn={'type':'metacafe','obj':'flash','thumb':'http://www.metacafe.com/thumb/'+vidId+'.jpg','url':'http://www.metacafe.com/fplayer/'+vidId+'/.swf','x':450,'y':370}}}
if(url['domain'].indexOf('video.google')!==-1){vidId=getParamValue(url['query'],'docid');if(vidId!==false&&url['path']=='/videoplay'){varReturn={'type':'google','obj':'flash','thumb':false,'url':'http://video.google.com/googleplayer.swf?docId='+url['query'].replace(/docid=([0-9]+)/,function(x,y){return y;})+'&hl=en','x':450,'y':370}}}
if(url['domain'].indexOf('dailymotion.com')!==-1){vidId=url['path'].replace(/^.*?\/video\/([a-z0-9]+).*?$/g,function(x,y){return y;});if(vidId!=url['path']){varReturn={'type':'dailymotion','obj':'flash','thumb':'http://www.dailymotion.com/thumbnail/160x120/video/'+vidId,'url':'http://www.dailymotion.com/swf/'+vidId,'x':450,'y':370}}}
if(url['domain'].indexOf('vimeo.com')!==-1){vidId=url['path'].replace(/^\/([0-9]+)\/?$/g,function(x,y){return y;});if(vidId!=url['path']){varReturn={'type':'vimeo','obj':'flash','thumb':false,'url':'http://www.vimeo.com/moogaloop.swf?clip_id='+vidId+'&server=www.vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=0&color=','x':450,'y':370}}}}
return varReturn;}
function getParamValue(url,param){url=url.split(/&/);for(var value in url){foo=url[value].split(/=/);if(foo[0]==param){return foo[1];}}
return false;}
function parseUrl(url){var regExp=/^([^:]+):\/\/([^\/]+)\/(.*)$/g;var ini,sheme='',domain='',path='',query='',anchor='';var urlPart=false;if(url.search(regExp)!==-1){sheme=url.replace(/^([^:]+).*$/g,function(x,y){return y;});domain=url.replace(/^[^:]+:\/\/([^\/]+).*$/g,function(x,y){return y;});path=url.replace(/^[^:]+:\/\/[^\/]+\/(.*)$/g,function(x,y){return y;});ini=path.indexOf('#');if(ini!==-1){anchor=path.slice(ini+1);path=url.slice(0,ini);}
ini=path.indexOf('?');if(ini!==-1){query=path.slice(ini+1);path=path.slice(0,ini);}
return{'sheme':sheme,'domain':domain,'path':'/'+path,'query':query,'anchor':anchor};}else{return false;}}