// Author: Afly
// Update: 2005-9-10
// Web: http://www.playes.net
// Function: Common JS Function
var StrTitle = "FeedBack Information - Playes.NET\n---------------------------------------------\n\n";
var IsIE=document.all&&document.getElementById;
var IsNS=document.getElementById&&!document.all;
var MusicBoxWin=0;
var SkinMenuObj='Skin: DefaultSkin: CnBlogSkin: iCandy\
\
Show/Hide SideBar\
';
var LineMenuObj='';
function Confirm(Str){ if(!confirm(StrTitle + Str)) return false; }
function Alert(Str){ window.alert(StrTitle + Str); }
function IsNumber(){ return ((event.keyCode >= 48) && (event.keyCode <= 57)); }
function GetFileName(url, opt){ document.write(url.substr(url.lastIndexOf(opt)+1)); }
function ReplaceSpace(Str){ return Str.replace(/ /g,"%20"); }
function CopyText(objID){ window.clipboardData.setData("Text",""+objID+""); }
function AddFav(StrURL,StrTitle){ window.external.AddFavorite(StrURL,StrTitle); }
function CheckNull(ObjID,Str) {
var Obj=document.getElementById(ObjID);
if(Obj.value == "" ) {
if(Str&&Str!="") Alert(Str);
Obj.focus();
return false;
}
}
// New Central Windows
function OpenWin(winU,winN,winW,winH){
return window.open(winU,winN,'status=no,resizable=no,width='+winW+',height='+winH+',left='+(screen.width-winW)/2+',top='+(screen.height-winH)/2+'');
}
function ShowHide(objID){
var obj=document.getElementById(objID);
if(obj.style.display!='none'){
obj.style.display='none';
}
else{
obj.style.display='block';
}
}
function RunCode(ObjID) {
var Obj=document.getElementById(ObjID);
if (Obj&&Obj.value!=""){
var newwin=window.open('','','');
newwin.opener = null
newwin.document.write(Obj.value);
newwin.document.close();
}
}
function CopyTextArea(ObjID){
var Obj=document.getElementById(ObjID);
if (Obj) {
Obj.select();
js=Obj.createTextRange();
js.execCommand("Copy");
}
}
function GetLength(ObjID){
var Obj=document.getElementById(ObjID);
alert("Current Text: "+Obj.value.length+" Byte\t\n");
Obj.focus();
}
function SelectAll(ObjID) {
var Obj=document.getElementsByName(ObjID);
for (var i=0; i5/4){
if(img.width>=MaxWidth){
ThisPic.width=MaxWidth;
ThisPic.height=img.height*MaxWidth/img.width;
}
}
else{
if (img.height>MaxHeight){
ThisPic.height=MaxHeight;
ThisPic.width=img.width*MaxHeight/img.height;
}
}
}
function ImgOpen(ThisPic){
window.open(ThisPic.src);
}
function SwitchSidebar(){
try{
var ObjSidebar=document.getElementById("BlogSidebar");
var ObjBody=document.getElementById("InnerBody");
if(ObjBody.className!="FullInnerBody"){
ObjSidebar.style.display="none";
ObjBody.className="FullInnerBody";
}else{
ObjSidebar.style.display="block";
ObjBody.className="InnerBody";
}
}catch(e){}
}
function OpenMusicBox(MusicURL){
MusicBoxWin = OpenWin(MusicURL, 'MusicBoxWin', '280', '280');
}
function PlayMusicBox(MusicURL) {
MusicBoxWin = OpenWin("/showblog/Musicbox/Music.asp?Single="+MusicURL, 'MusicBoxWin', '280', '120');
}
function PlayVideoBox(VideoURL) {
VideoBoxWin = OpenWin("/showblog/Musicbox/Video.asp?URL="+VideoURL, 'VideoBoxWin', '450', '400');
}
function MouseOver(){
var Elm = event.srcElement;
if( Elm.title ) { window.status = Elm.title;}
else if( Elm.alt ) { window.status = Elm.alt;}
else if( Elm.tagName.toLowerCase()=="a" ) { window.status = Elm.innerText;}
else if( Elm.tagName.toLowerCase()=="strong"||Elm.tagName.toLowerCase()=="b" ) { window.status = Elm.innerText;}
else { return false;}
return true;
}
function MouseOut(){
window.status = ""; return false;
}
function HideMenu(){
var SkinObj=document.getElementById("SkinMenu");
if (SkinObj) SkinObj.style.display='none';
}
function ShowMenu(evnt){
try{
var SkinObj=document.getElementById("SkinMenu");
var Elm = document.all ? event.srcElement : evnt.target;
SkinObj.style.display='none';
var TextObj=document.all?Elm.document.selection.createRange().text:false;
var MenuBody;
if (Elm.tagName.toLowerCase()=='input'||Elm.tagName.toLowerCase()=='textarea'||TextObj){
return true;
}
else if (Elm.tagName.toLowerCase()=='img'){
MenuBody='Open This Image';
if(document.all) MenuBody=MenuBody+LineMenuObj+'Copy Image ShortCut';
if(Elm.parentNode.tagName.toLowerCase()=='a') MenuBody=MenuBody+LineMenuObj+'Open'+'Open In A New Window';
SkinObj.innerHTML=MenuBody;
SkinObj.style.display='block';
}
else if (Elm.tagName.toLowerCase()=='a'||Elm.parentNode.tagName.toLowerCase()=='a'){
if (document.all&&event.ctrlKey){
return true;
}else{
if(Elm.parentNode.tagName.toLowerCase()=='a') Elm=Elm.parentNode;
var FavTitle=Elm.title?Elm.title:Elm.innerText;
MenuBody='Open'+'Open In A New Window';
if(document.all) MenuBody=MenuBody+LineMenuObj+'Copy Link ShortCut'+LineMenuObj+'Add To Favourite';
SkinObj.innerHTML=MenuBody;
SkinObj.style.display='block';
}
}
else {
SkinObj.innerHTML=SkinMenuObj+"Refresh"+"View HTML Source";
SkinObj.style.display='block';
}
var MenuTop=document.all?document.documentElement.scrollTop+event.clientY-1:evnt.pageY;
var MenuLeft=document.all?document.documentElement.scrollLeft+event.clientX-1:evnt.pageX;
if (MenuLeft+SkinObj.scrollWidth>document.documentElement.scrollLeft+document.documentElement.clientWidth){MenuLeft=MenuLeft-SkinObj.scrollWidth;}
if (MenuTop+SkinObj.scrollHeight>document.documentElement.scrollTop+document.documentElement.clientHeight){MenuTop=MenuTop-SkinObj.scrollHeight;}
SkinObj.style.top=MenuTop+'px';
SkinObj.style.left=MenuLeft+'px';
return false;
}catch(e){}
}
document.onclick=HideMenu;document.oncontextmenu=ShowMenu;
if (document.all){ document.onmouseover=MouseOver;document.onmouseout=MouseOut; }
//window.onerror=function(m,u,l){
// if(!confirm("Java Script Error\n"+"\nDescription:"+m+"\nSource:"+u+"\nLine:"+l+"\n\nSee more details?"))onerror=null;
//}