function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}
function trigger_effect(src_element,div_id, effect, first_img, second_img){
	Effect.toggle(div_id, effect, {beforeFinish:function(){
	image = src_element.getElementsByTagName('img')[0];
	image.src = image.src.match(first_img) ? second_img : first_img;
	}});
	return true;
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

function writeMov(src,height,width,autoplay) {
	height=height+16;
	document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="' + height + '" width="' + width + '"><param name="src" value="' + src + '"><param name="autoplay" value="' + autoplay + '"><param name="type" value="video/quicktime" height="' + height + '" width="' + width + '"><embed src="' + src + '" autoplay="' + autoplay + '" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/" height="' + height + '" width="' + width + '"></object>');
}

function trim ( string ) {
	var i, numFirstChar = -1, numLastChar = -1;
	for ( i = 0; i < string.length; i ++ ) {
		if ( string.substring ( i, i + 1 ) != ' ' ) {
			numFirstChar = i;
			break;
		}
	}
	if ( numFirstChar == -1 )
		return "";
	for ( i = string.length; i >= 0; i -- ) {
		if ( string.substring ( i - 1, i ) != ' ' ) {
			numLastChar = i;
			break;
		}
	}
	return string.substring ( numFirstChar, numLastChar );
}
function isEmail(email) {
	var valid_email_address = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return valid_email_address.test(email)
}
function isPhoneNumber(phone) {
	var valid_phone_number=/^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$/;
	return valid_phone_number.test(phone)
}


function pcase(str) {
	strlen = str.length
	jj = str.substring(0,1).toUpperCase()
	jj = jj + str.substring(1,strlen).toLowerCase()
	for (i = 2; i <= strlen; i++) {
		if (jj.charAt(i)==" ") {
			lefthalf = jj.substring(0,i+1)
			righthalf = jj.substring(i+1,strlen)
			righthalf = righthalf.substring(0,1).toUpperCase()+righthalf.substring(1,strlen)
			jj=lefthalf+righthalf
		}
	}
	return jj
}

function AutoResizeIFrm(ifrmobj) {
	if (document.getElementById) {
		var success = 0;
		var oFrame = ifrmobj; //document.getElementById("ifrm");
		if(oFrame.style.display=='none') {
			oFrame.style.height='0px';
			oFrame.style.display='inline';
		}
		var oLoading = document.getElementById('loading');
		if(oLoading) {
			oLoading.style.display='none';
		}
		// Mozilla solution
			if ((oFrame.contentDocument) && !(navigator && navigator.userAgent && navigator.userAgent.indexOf("MSIE") != -1 && ifrmobj)) {
//			alert("id='" + oFrame.id + "' height='" + oFrame.contentDocument.height + "'");
			var height = oFrame.contentDocument.body.scrollHeight;
//			if (height > 100) {
				oFrame.style.height = (height+20) + "px";
				success = 1;
//			}
			// IE solution
		} else if (navigator && navigator.userAgent && navigator.userAgent.indexOf("MSIE") != -1 && ifrmobj) {
			var oBody = ifrmobj.contentWindow.document.body;
			var height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
//			alert("id='" + oFrame.id + "' height='" + ifrmobj.contentWindow.document.body.scrollHeight + "'");
//			if (height > 100) {
				oFrame.style.height = (height+20) + "px";
				success = 1;
//			}
		}
	}
	if(window.frameElement) {
		//alert("window.frameElement.id='"+window.frameElement.id+"'");
		parent.AutoResizeIFrm(window.frameElement);
	}
}


