// JavaScript Document

	var currentvideo = "";
	function changeVideo(videoname) {
		if (videoname != currentvideo) {

			var sObj = '<br/>' +
				'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="640"  height="520" title="VMLogix">' +
				'<param name="movie" value="images/stories/videos/'+ videoname + '.swf" />' +
				 '<param name="quality" value="high" />' +
				  '<param name="wmode" value="transparent" />' +
				  '<param name="bgcolor" value="#FFFFFF" />' +
				  '<embed src="images/stories/videos/'+ videoname + '.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgcolor="#FFFFFF" width="640"  height="480"></embed>' +
				'</object>';			
							  
			document.getElementById("divClip").innerHTML = sObj;
			currentvideo = videoname;
		}
	}

	function open_video(video, title, width, height){
		if(width == '700')
		{
			width1 = '640';
			height1 = '520';
			newWindow("http://www.vmlogix.com/video.php?video="+video+"&title="+title+"&width="+width1+"&height="+height1, title , width , height, 1, 0, 0, 0, 0, 1, 0);

		}
		else
		{
			newWindow("http://www.vmlogix.com/video.php?video="+video+"&title="+title+"&width="+width+"&height="+height, title , width , height, 1, 0, 0, 0, 0, 1, 0);
		}
	}
	
	function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen)
	{
		a_int_windowWidth = (parseInt(a_int_windowWidth) + 40);
		a_int_windowHeight = (parseInt(a_int_windowHeight) + 40);

		var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
		var int_windowTop = (screen.height - a_int_windowHeight) / 2;
		
		var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
		//var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties);
		var obj_window = window.open(a_str_windowURL, null,  str_windowProperties);
		if (parseInt(navigator.appVersion) >= 4) {
			obj_window.window.focus();
		}
	}

	function screenshot(pic, title){
			newWindow("http://www.vmlogix.com/screenshot.php?pic="+pic+"&title="+title , title, '1024' , '768', 1, 0, 0, 0, 0, 1, 0);
	}
	function screenshot1(pic, title){
			newWindow("http://www.vmlogix.com/screenshot.php?pic="+pic+"&title="+title , title, '828' , '545', 1, 0, 0, 0, 0, 1, 0);
	}
	
	
// form validation helpers
String.prototype.trim = function() {
     return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
     return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
     return this.replace(/\s+$/,"");
}

function isPhoneNumber(s) {
	// Check for correct phone number
	rePhoneNumber = /^\(?\d{3}\)?\s|-\d{3}-\d{4}$/;
	rePhoneNumberInternational = /^\d(\d|-){7,20}/;
	
	if(s == '0000000000' || s == '000-000-0000' || s == '1234567890' || s == '123-456-7890') return false;
	if (!rePhoneNumber.test(s) && !rePhoneNumberInternational.test(s)) return false;
	
	return true;
}
function isEmail(s) {
	// Check for correct phone number
	reEmail = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
	if (!reEmail.test(s)) return false;
	
	return true;
}
function alphaNumericCheck(s){
	reAlphaNumericOnly = /\W/;
	if (reAlphaNumericOnly.test(s)) return false;
	
	return true;
}
