function getDatabyForm(formId) {
	var data = {};
	try {
		$('#' + formId).find("input,select,textarea").each(function() {
			if (this.name) {
				// alert(this.name + $(this).val());
				if ($(this).attr('type') == 'radio') {
					if ($(this).attr('checked'))
						data[this.name] = $(this).val();
				} else if ($(this).attr('type') == 'checkbox') {
					if ($(this).attr('checked'))
						data[this.name] = $(this).val();
				} else
					data[this.name] = $(this).val();
			}
		});
	} catch (e) {
		alert("err" + e);
	}
	return data;
}

function S4() {
	return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}

function guid() {
	return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
}

function isInteger(value){
	reg=/(^0$)|(^([1-9]+)([0-9]*)$)/;
	if(reg.test(value)){
	    return true;
	}else{
	    return false;
	}
}

/*
 * Get the x pos of mouse in the page.
 */
function mouseX(evt) {
	if (evt.pageX)
		return evt.pageX;
	else if (evt.clientX)
		return evt.clientX + (document.documentElement.scrollLeft ?
				document.documentElement.scrollLeft :
				document.body.scrollLeft);
	else return null;
}

/*
 * Get the y pos of mouse in the page.
 */
function mouseY(evt) {
	if (evt.pageY)
		return evt.pageY;
	else if (evt.clientY)
		return evt.clientY + (document.documentElement.scrollTop ?
				document.documentElement.scrollTop :
				document.body.scrollTop);
	else return null;
}

/*
 * * Show the div
*/
function showDiv(e,divId) {
	var layoutDiv = $("#" + divId);
	var x = mouseX(e);
	var y = mouseY(e);
	layoutDiv.css({position:"absolute",left:x+"px",top:y+"px","z-index":1999});    
	layoutDiv.fadeIn("slow");
}
	
/*
 * Hide the div
 */
function hideDiv(divId) {
	var layoutDiv = $("#" + divId);   
	layoutDiv.fadeOut("slow");
}
