function showShare(type,hash,obj,id){
if (!document.getElementById('share_flash_' + id)) {
var videoAddr;
switch (type) {
case 'youku.com':
videoAddr = 'http://player.youku.com/player.php/sid/'+hash+'=/v.swf';
break;
case 'youtube.com':
videoAddr = 'http://www.youtube.com/v/'+hash;
break;
case 'sina.com.cn':
videoAddr = 'http://vhead.blog.sina.com.cn/player/outer_player.swf?vid='+hash;
break;
case 'sohu.com':
videoAddr = 'http://v.blog.sohu.com/fo/v4/'+hash;
break;
case 'music':
if (hash.match(/^http\:\/\/.{4,251}\.mp3$/i)) {
var vObject = '';
} else if (hash.match(/^http\:\/\/.{4,251}\.wma$/i)) {
var vObject = '';
} else {
alert('type_error');
return false;
}
break;
case 'flash':
if (hash.match(/\.swf$/i)) {
var vObject = '';
} else {
alert('type_error');
return false;
}
break;
default:
showDialog('error','数据已失效,请点击链接地址查看该分享');
return false;
}
if (!vObject) {
var vObject = '';
}
var pObject = obj.parentNode;
var flash = document.createElement('div');
flash.id = 'share_flash_' + id;
flash.innerHTML = vObject;
pObject.appendChild(flash);
var close = document.createElement('div');
close.id = 'share_close_' + id;
close.className = 'video-close';
var a = document.createElement('a');
a.className = 'video-close-link';
a.href = 'javascript:void(0);';
a.onclick = function(){
document.getElementById('share_flash_' + id).style.display = 'none';
document.getElementById('share_close_' + id).style.display = 'none';
obj.style.display = '';
};
a.innerHTML = '收起';
close.appendChild(a);
pObject.appendChild(flash);
pObject.appendChild(close);
} else {
document.getElementById('share_flash_' + id).style.display = '';
document.getElementById('share_close_' + id).style.display = '';
}
obj.style.display = 'none';
}
function delShare(id){
ajax.send('mode.php?m=o&q=ajax&action=delshare&id='+id,'',function(){
var rText = ajax.request.responseText.split('\t');
if (rText[0] == 'success') {
var element = document.getElementById('share_'+id);
if (element) {
element.parentNode.removeChild(element);
} else {
alert(ajax.request.responseText);
}
} else {
ajax.guide();
}
});
}