function getWindowWidth() {
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	}
	else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		}
		else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function fnExpandContractDiggBox() {

	var diggBox = $('bottom_rcorner');
	var marqueeDiggRSS = $('marqueeDiggRSS');
	var spanExpandContract = $('spanExpandContract');
	
	var diggBoxTop = parseInt(diggBox.style.top.substring(0, (diggBox.style.top.length - 2)));
	
	if(spanExpandContract.innerHTML == 'expand') {
		diggBox.style.top = (diggBoxTop - 100) + 'px';
		diggBox.style.height = (diggBox.offsetHeight + 100) + 'px';
		marqueeDiggRSS.style.height = (marqueeDiggRSS.offsetHeight + 100) + 'px';
		marqueeDiggRSS.style.width = '100%';
		spanExpandContract.innerHTML = 'contract';
	} else {
		diggBox.style.top = (diggBoxTop + 100) + 'px';
		diggBox.style.height = (diggBox.offsetHeight - 100) + 'px';
		marqueeDiggRSS.style.height = (marqueeDiggRSS.offsetHeight - 100) + 'px';
		marqueeDiggRSS.style.width = '90%';
		spanExpandContract.innerHTML = 'expand';
	}
	
}

function MailPage(sURL) {
	var sMail = "mailto:?subject=A page that might interest you.&body=Hi, Please check this page " + escape(sURL);
	document.location.href = sMail;
}

function specialChar(s){ return s.replace(/[a-zA-Z/]/g,"").length>0; }

function isEmail(email) {
	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)$/; // valid
	return (!reg1.test(email) && reg2.test(email))
}

function isValidNumber(numval, uType) {
	var myRegExp;
	if(uType == 'Num') myRegExp = new RegExp("^[0-9]*$");
	else if(uType == 'BoolNum') myRegExp = new RegExp("^[/+|/-]?[0-9]*$");
	else myRegExp = new RegExp("^[/+|/-]?[0-9]*[/.]?[0-9]*$"); 
	return myRegExp.test(numval); 
}

function fileValidation(fname, fextensions) {
	
	var patternStr = '^.+\.(' + fextensions + ')$';
	
	var myregexp = new RegExp(patternStr, "gi")
	
	if (fname.search(myregexp) != -1) {
		return true;
	} else {
		return false;
	}
	
}
