﻿// JScript File
function reSizeTable(obj){        
    if(obj == null)
        return;
    obj.style.height = document.documentElement.clientHeight+'px';
    obj.style.width = document.documentElement.clientWidth+'px';
}

function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	}
	else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	}
	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}  	
	var arr = new Array(xWithScroll,yWithScroll);
	return arr;
}

function getScrollHeight(){
    var ScrollTop = document.body.scrollTop;
    if (ScrollTop == 0){
        if (window.pageYOffset)
            ScrollTop = window.pageYOffset;
        else
            ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
    }
    return ScrollTop;
}
function changeBg(trObj){
    var tempClr = trObj.style.backgroundColor;
    trObj.style.backgroundColor = '#FCEDD7';
    trObj.onmouseout = function(){
        trObj.style.backgroundColor = tempClr;
    };
}

function showOpacDiv(){
  var divEle = document.getElementById('divOpac');
  alert(document.getElementById('divOpac').style.display);
  divEle.style.display = 'inline';
  var arrXY = getPageSizeWithScroll();
  divEle.style.width=arrXY[0]+'px';
  divEle.style.height=arrXY[1]+'px';
}
function hideOpacDiv(){
   document.getElementById('divOpac').style.display='none';
}

///To input only digits
function onlyNumbers(txtObj){
    txtObj.value=txtObj.value.replace(/[^\d]/g, '');
}
///To input only digits & -
function onlyNumsHyps(txtObj){
    txtObj.value=txtObj.value.replace(/[^\d|^\-]/g, '');
}
///To input alphabets only
function onlyAlphabets(txtObj){
    txtObj.value=txtObj.value.replace(/[^a-zA-Z|^\s]/g,'');
}
///To validate EmailIDs
function IsEmailID(strEmail){    
    var val=strEmail.search(/\w+\@\w+\.[a-zA-Z]+[a-zA-Z|\.]+/);
    if(val>=0)
        return true;
    else
        return false;                
}
///Trim Function removes white spaces
function cTrim(str){
    return str.replace(/^\s+|\s+$/g, '');
}
