function openscript(url, width, height) {
	Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=no,status=no' );
	Win.focus();
}

function clearform(text,which){
	if (which.value==text)
	which.value=''}


function check(form){    
	mailx = document.mmcform.emailaddress.value;
	if ( mailx == "" || mailx.indexOf ('@', 0) == -1 ||  mailx.indexOf ('.', 0) == -1)
	{
		alert ("Invalid E-mail Address !");
		return false;
	}
}



/*
 * POPUP WINDOW
 * Bind open new window function for element with ID openPopup (#openPopup)
 * Class: openPopup pop_[Width]x[Height]
 * To create popup 800x600, use class: openPopup pop_800x600
*/

function openPopup() {
	$("a.openPopup").each( function() {
		$(this).click(function() {
			var winpop;
			var xurl = $(this).attr('href');
			var xtarget = '_blank';
			var thisClass = $(this).attr('class').split(' ');
			var re = new RegExp('^(pop_)');
			for(i=0;i<thisClass.length;i++) {
				if(thisClass[i].match(re)) {
					popSizes = thisClass[i].split('_');
					popSize = popSizes[1].split('x');
					popWidth = popSize[0];
					popHeight = popSize[1];
				}
			}
			
			winpop = window.open(xurl, xtarget,'width=' + popWidth + ',height=' + popHeight + ',resizable=0,scrollbars=yes,menubar=no,status=no' );
			winpop.focus();
			return false;
		});
	});
}

/*
 * ADD TO FAVORITES
 * 
*/

function bookmark(url, title) {
	
	var url = location.href;
	var title = document.title;
	
	$("a#bookmark").click(function(){
		if($.browser.msie) {
			window.external.AddFavorite(url, title); // IE/Win
		} else if($.browser.mozilla) {
			$(this).attr("title",document.title);
		} else if($.browser.opera) {
			void(0);
		} else if($.browser.safari) {
			alert('You need to press CTRL/Cmd + D to bookmark our site.');	
		} else {
			alert('In order to bookmark this site you need to do so manually through your browser.');
		}
	});

}
