﻿// JScript File
<!--
function gel(a){
	return document.getElementById?document.getElementById(a):null;
}
function gelstn(a){
	return document.getElementsByTagName?document.getElementsByTagName(a):new Array();
}
function geln(a){
	return document.getElementsByName?document.getElementsByName(a):new Array();
}
function $w(a){
	document.write(a);
}


/*
    barDiv: this，放置按钮的DIV
    divId : 
*/
function SwitchDiv(barDiv, divId)
{
 
    div = gel(divId);
    
    if(div.style.display == 'none')
    {
        div.style.display='block'
        barDiv.innerHTML = "▲"
        //barDiv.innerHTML = "<img  alt=''width='20' height='15'   src='./images/bar_up.ico'/>";
    }
    else
    {
        div.style.display='none'
        barDiv.innerHTML = "▼"
        //barDiv.innerHTML = "<img alt=''width='20' height='15'   src='./images/bar_down.ico'/>";
    }
}

function SwitchDiv2(barDiv, divId, divId2)
{
 
    div = gel(divId);
    div2 = gel(divId2);
    
    if(div.style.display == 'none')
    {
        div.style.display='block'
        div2.style.display='none'
        barDiv.innerHTML = "<a style='font-size:12px;'>显示更多...</a>"
        //barDiv.innerHTML = "<img  alt=''width='20' height='15'   src='./images/bar_up.ico'/>";
    }
    else
    {
        div.style.display='none'
        div2.style.display='block'
        barDiv.innerHTML = "▲"
        //barDiv.innerHTML = "<img alt=''width='20' height='15'   src='./images/bar_down.ico'/>";
    }
}

function SwitchDiv3(barDiv, divId)
{
 
    div = gel(divId);
    
    if(div.style.display == 'none')
    {
        div.style.display='block'
        //barDiv.innerHTML = "<img  alt=''width='20' height='15'   src='./images/bar_up.ico'/>";
    }
    else
    {
        div.style.display='none'
        //barDiv.innerHTML = "<img alt=''width='20' height='15'   src='./images/bar_down.ico'/>";
    }
}


function setCopy(_sTxt){try{clipboardData.setData('Text',_sTxt)}catch(e){}}
function setHome(){try{window.external.AddFavorite(window.document.location,window.document.title)}catch(e){};}

function GetInfo(ctrlId)
{
    var o = document.getElementById(ctrlId)
    var to = new Object();
    to.left = to.right = to.top = to.bottom = 0;
    to.width = to.height = 0;
    to.width = o.offsetWidth;
    to.height = o.offsetHeight;
    
    while(o && o != document.body)
    {
        if(o.tagName && o.tagName.toUpperCase()=="HTML") 
		{
			break;
		}
        to.left += o.offsetLeft;
        to.top += o.offsetTop;
        o = o.offsetParent; 
    } 
    to.right = to.left + to.width; 
    to.bottom = to.top + to.height; 
    //alert(to.left +";"+ to.top +";"+ to.width +";"+ to.height);
    return to; 
}  


function GetObjInfo(obj)
{
    var o = obj;
    var to = new Object();
    to.left = to.right = to.top = to.bottom = 0;
    to.width = to.height = 0;
    to.width = o.offsetWidth;
    to.height = o.offsetHeight;
    
    while(o && o != document.body)
    {
        if(o.tagName && o.tagName.toUpperCase()=="HTML") 
	    {
		    break;
	    }
        to.left += o.offsetLeft;
        to.top += o.offsetTop;
        o = o.offsetParent; 
    } 
    to.right = to.left + to.width; 
    to.bottom = to.top + to.height; 
    return to; 
}  

function prints(str) {

var matchPIC = new RegExp("((?:http|https|ftp|mms|rtsp)://(&(?=amp;)|[A-Za-z0-9\./=\?%_~@#:;\+\-])+(gif|jpg|png|bmp))", "ig");
var matchURL = new RegExp("((?:http|https|ftp|mms|rtsp)://(&(?=amp;)|[A-Za-z0-9\./=\?%_~@&#:;\+\-])+)","ig");
var str2 ="";
str2 =str.replace("&nbsp;"," ")
   if(matchPIC.test(str)){                    
        document.write(str2.replace(matchPIC, "$1<img src=\"$1\" hint=\"$1\"></img>"));     
   }else{        
          document.write(str2.replace(matchURL, "<a target=\"_blank\" href=\"$1\">$1</a>"));
   }
}

function openVbox(URL) {
    a=window.open(URL,'vbox','width=380, height=485,top=200,left=80');
    a.moveTo((screen.width-380)/2,(screen.height-485)/2);
    return false;
}

String.prototype.UBB=function()
{
	var str=this;
    var matchPIC = new RegExp("((?:http|https|ftp|mms|rtsp)://(&(?=amp;)|[A-Za-z0-9\./=\?%_~@#:;\+\-])+(gif|jpg|png|bmp))", "ig");
    var matchURL = new RegExp("((?:http|https|ftp|mms|rtsp)://(&(?=amp;)|[A-Za-z0-9\./=\?%_~@&#:;\+\-])+)","ig");
    str=str.replace("&nbsp;"," ");
    str=str.replace(matchURL, "<a target=\"_blank\" href=\"$1\">$1</a>");

	str=str.replace(/\[Smilies(.+?)\]/ig,"<IMG SRC=\"./inc/img/emote/$1.gif\"/>");/**/
	return str;
}

String.prototype.UBBEx=function()
{
	var str=this;
    var matchPIC = new RegExp("((?:http|https|ftp|mms|rtsp)://(&(?=amp;)|[A-Za-z0-9\./=\?%_~@#:;\+\-])+(gif|jpg|png|bmp))", "ig");
    var matchURL = new RegExp("((?:http|https|ftp|mms|rtsp)://(&(?=amp;)|[A-Za-z0-9\./=\?%_~@&#:;\+\-])+)","ig");
    str=str.replace("&nbsp;"," ");
    str=str.replace(matchURL, "<a target=\"_blank\" href=\"$1\">$1</a>");

	str=str.replace(/\[Smilies(.+?)\]/ig,
	    "<IMG style='border-width:0px;' SRC=\"./inc/img/emote/$1.gif\"/>"
	    );
	    
	return str;
}

 String.prototype.UBBIMG=function()
    {
	    var str=this;
        var matchPIC = new RegExp("((?:http|https|ftp|mms|rtsp)://(&(?=amp;)|[A-Za-z0-9\./=\?%_~@#:;\+\-])+(gif|jpg|png|bmp))", "ig");
        var matchURL = new RegExp("((?:http|https|ftp|mms|rtsp)://(&(?=amp;)|[A-Za-z0-9\./=\?%_~@&#:;\+\-])+)","ig");
        
        //alert(str);
        str=str.replace("&nbsp;"," ");
        str=str.replace(matchURL, "<a target=\"_blank\" href=\"$1\">$1</a>");

	    str=str.replace(/\[Smilies(.+?)\]/ig,
	        "<IMG style='border-width:0px;' SRC=\"./inc/img/emote/$1.gif\"/>"
	        );
	        
	    str=str.replace(/\[Img\[(.+?).thumb.jpg\]\]/ig,
	        "<div><img id='loadingimg' alt='' src='./inc/img/loading.gif' />"
	        +" <IMG alt='点击查看大图' onload=\"img_resize(this);\" " 	        
	        + " onclick=\"window.open('OriginalPhoto.aspx?src=" + "http://$1.original.jpg" + " ', '','height=' + window.screen.height + ', width=' + window.screen.width +',toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes' );\"  "
	        + " onmouseover=\"popup(this);\" "
	        + " style='display:none; cursor:hand;border-width:0px;' SRC=\"http://$1.original.jpg\"/></div>"
	        );
	        
	    str=str.replace(/\[TImg\[(.+?).thumb.jpg\]\]/ig,
	        "<div><img id='loadingimg' alt='' src='./inc/img/loading.gif' /><IMG alt='点击查看大图' "
	        + " onload=\"img_resize(this);\" "
	        + " onclick=\"window.open('OriginalPhoto.aspx?src=" + "file://$1.original.jpg" + " ', '','height=' + window.screen.height + ', width=' + window.screen.width +',toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes' );\"  "
	        + " onmouseover=\"popup(this);\" "
	        + " style='display:none; cursor:hand;border-width:0px;' SRC=\"file://$1.original.jpg\"/></div>"
	        ); 
	    return str;
    }
    
function htmlEncode(strS){
    return(strS.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ /g,"&nbsp;").replace(/\n/g,"<br\/>"));
}

function htmlDecode(strS){
    return(strS.replace(/&nbsp;/ig," ").replace(/&gt;/ig,">").replace(/&lt;/ig,"<").replace(/&amp;/ig,"&"));
}
-->