
window.onscroll = scroll;
var DvMsgBxW = 600;
var DvMsgBxH = 500;
var popupDivId = "";
function scroll()
{
	var DvMsgBx;
	if(popupDivId != "")
	    DvMsgBx=document.getElementById(popupDivId);
	else
	    DvMsgBx=document.getElementById('DvMsgBx');
	
	if(DvMsgBx)
	{
	    if (DvMsgBx.style.display == 'block')
        {
	        if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) 
	        {	
		        yScroll = window.innerHeight + window.scrollMaxY;
		        xScroll = window.innerWidth + window.scrollMaxX;
		        var deff = document.documentElement;
		        var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
		        var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
		        xScroll -= (window.innerWidth - wff);
		        yScroll -= (window.innerHeight - hff);
		    }
	        else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth)
		    {
		        yScroll = document.body.scrollHeight;
		        xScroll = document.body.scrollWidth;
		    }
            else 
	        {
		        yScroll = document.body.offsetHeight;
		        xScroll = document.body.offsetWidth;
            }
	        var arrayPageScroll=TB_getPageScrollTop();
	        var pagesize = TB_getPageSize();	
	        var arrayPageScroll = TB_getPageScrollTop();
	        DvMsgBx.style.marginLeft = -(DvMsgBxW/2)+'px';
	        DvMsgBx.style.top=(arrayPageScroll[1] + (pagesize[1]-DvMsgBxH)/2) + 'px';	        
	        DvMsgBx.style.width=DvMsgBxW + 'px';
        }
    }
};
function ShowDv(divId) {
    var DvMain,Ifrme,DvMsgBx;
    DvMain=document.getElementById('MainDv');
    Ifrme=document.getElementById('Ifrm');
    var divToPopup=null;
    if(divId) {
        popupDivId=divId;
        divToPopup=divId;
    }
    else {
        popupDivId='DvMsgBx';
        divToPopup='DvMsgBx';
    }
    DvMsgBx=document.getElementById(divToPopup);
    if(DvMsgBx) {
        if(DvMsgBx.style.width) {
            if(DvMsgBx.style.width.length>0)
                DvMsgBxW=DvMsgBx.style.width.replace("px","");
        }
    }
    Ifrme.style.display='block';
    DvMain.style.display='block';
    DvMsgBx.style.display='block';
    if(window.innerHeight&&window.scrollMaxY||window.innerWidth&&window.scrollMaxX) {
        yScroll=window.innerHeight+window.scrollMaxY;
        xScroll=window.innerWidth-20;
        var deff=document.documentElement;
        var wff=(deff&&deff.clientWidth)||document.body.clientWidth||window.innerWidth||self.innerWidth;
        var hff=(deff&&deff.clientHeight)||document.body.clientHeight||window.innerHeight||self.innerHeight;
        xScroll-=(window.innerWidth-wff);
        yScroll-=(window.innerHeight-hff);
    }
    else if(document.body.scrollHeight>document.body.offsetHeight||document.body.scrollWidth>document.body.offsetWidth) {
        yScroll=document.body.scrollHeight;
        xScroll=document.body.scrollWidth;
    }
    else {
        yScroll=document.body.offsetHeight;
        xScroll=document.body.offsetWidth-10;
    }
    DvMain.style.height=yScroll+'px';
    DvMain.style.width="100%";
    Ifrme.style.height=yScroll+'px';
    Ifrme.style.width="100%";

    var arrayPageScroll=TB_getPageScrollTop();
    var pagesize=TB_getPageSize();
    var arrayPageScroll=TB_getPageScrollTop();
    DvMsgBx.style.marginLeft= -(DvMsgBxW/2)+'px';
    DvMsgBx.style.top=(arrayPageScroll[1]+(pagesize[1]-DvMsgBxH)/2)+'px';
    DvMsgBx.style.width=DvMsgBxW+'px';
};
function ShowDvRssFeed(divId,rssid) {
    var DvMain,Ifrme,DvMsgBx,divToPopup;
    DvMain=document.getElementById('MainDv');
    Ifrme=document.getElementById('Ifrm');
    var divToPopup=null;
    if(divId) {
        popupDivId=divId;
        divToPopup=divId;
    }
    else {
        popupDivId='DvMsgBx';
        divToPopup='DvMsgBx';
    }
    DvMsgBx=document.getElementById(divToPopup);
    if(DvMsgBx) {
        if(DvMsgBx.style.width) {
            if(DvMsgBx.style.width.length>0)
                DvMsgBxW=DvMsgBx.style.width.replace("px","");
        }
    }
    Ifrme.style.display='block';
    DvMain.style.display='block';
    DvMsgBx.style.display='block';
    if(window.innerHeight&&window.scrollMaxY||window.innerWidth&&window.scrollMaxX) {
        yScroll=window.innerHeight+window.scrollMaxY;
        xScroll=window.innerWidth-20;
        var deff=document.documentElement;
        var wff=(deff&&deff.clientWidth)||document.body.clientWidth||window.innerWidth||self.innerWidth;
        var hff=(deff&&deff.clientHeight)||document.body.clientHeight||window.innerHeight||self.innerHeight;
        xScroll-=(window.innerWidth-wff);
        yScroll-=(window.innerHeight-hff);
    }
    else if(document.body.scrollHeight>document.body.offsetHeight||document.body.scrollWidth>document.body.offsetWidth) {
        yScroll=document.body.scrollHeight;
        xScroll=document.body.scrollWidth;
    }
    else {
        yScroll=document.body.offsetHeight;
        xScroll=document.body.offsetWidth-10;
    }
    DvMain.style.height=yScroll+'px';
    DvMain.style.width="100%";
    Ifrme.style.height=yScroll+'px';
    Ifrme.style.width="100%";

    var arrayPageScroll=TB_getPageScrollTop();
    var pagesize=TB_getPageSize();
    var arrayPageScroll=TB_getPageScrollTop();
    DvMsgBx.style.marginLeft= -(DvMsgBxW/2)+'px';
    DvMsgBx.style.top=(arrayPageScroll[1]+(pagesize[1]-DvMsgBxH)/2)+'px';
    DvMsgBx.style.width=DvMsgBxW+'px';
win = new Window({className: "alphacube", title: "Email This", id: "emailmeid", width:455, height:305, showEffect:Effect.BlindDown, hideEffect: Effect.SwitchOff, resizable: false, destroyOnClose: true, maximizable: false, recenterAuto:false});
 
window.getContent().update('<iframe width="450" height="300" src="send_email.php?rssid='+rssid+'" frameborder="0" />'); win.showCenter(); 
	


};

function TB_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight
	arrayPageSize = new Array(w,h) 
	return arrayPageSize;
};

function TB_getPageScrollTop()
{
	var yScrolltop;
	var xScrollleft;
	if (self.pageYOffset || self.pageXOffset) 
	{
		yScrolltop = self.pageYOffset;
		xScrollleft = self.pageXOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft )
	{	 
		yScrolltop = document.documentElement.scrollTop;
		xScrollleft = document.documentElement.scrollLeft;
	}
	else if (document.body)
	{
		yScrolltop = document.body.scrollTop;
		xScrollleft = document.body.scrollLeft;
	}
	arrayPageScroll = new Array(xScrollleft,yScrolltop) 
	return arrayPageScroll;
};
function DvClose(Dvname)
{
    var dvname = document.getElementById(Dvname);
    if (dvname) {
        dvname.style.display = 'none';

        if (document.getElementById('MainDv'))
            document.getElementById('MainDv').style.display = 'none'
        if (document.getElementById('Ifrm'))
            document.getElementById('Ifrm').style.display = 'none'
    }
    else {
        if (window.parent) {
            dvname = window.parent.document.getElementById(Dvname);
            if (dvname)
                dvname.style.display = 'none';
            if (window.parent.document.getElementById('MainDv'))
                window.parent.document.getElementById('MainDv').style.display = 'none'
            if (window.parent.document.getElementById('Ifrm'))
                window.parent.document.getElementById('Ifrm').style.display = 'none'
        }   
    }
};



/* can customized */

var tabDiv /*= 'headCon1'*/;
var headTab /*= 'head1'*/;
function titleMenu(option,tabVal){
	
	
	if(document.getElementById(option).style.display=='none' || document.getElementById(option).style.display==''){
	document.getElementById(option).style.display = 'block';
	document.getElementById(tabVal).className = 'active';
	
	
	if(tabDiv !=undefined )
	document.getElementById(tabDiv).style.display = 'none';
		
	
	if(headTab !=undefined )
document.getElementById(headTab).className = '';


	}
	tabDiv = option;
	headTab = tabVal;
	
	
}

function forShow(id){
	document.getElementById(id).style.display = 'block';
}
function forHide(id){
	document.getElementById(id).style.display = 'none';
}

function forShowMulti(id, id2,id3){
	document.getElementById(id).style.display = 'block';
	if(id2 != ''){
		document.getElementById(id2).style.display = 'block';
	}
		if(id3 != ''){
		document.getElementById(id3).style.display = 'block';
	}
}
function forHideMulti(id,id2,id3){
	document.getElementById(id).style.display = 'none';
	
		if(id2 != ''){
		document.getElementById(id2).style.display = 'none';
	}
		if(id3 != ''){
		document.getElementById(id3).style.display = 'none';
	}
}

