﻿
function urlRandomizer() {
	var strChars = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";			
	var minLength = 30;
	var maxLength = 30;
	var diffLength = maxLength - minLength		
	var thisLength = Math.round((Math.random() * diffLength)+minLength);		
	var outLoop = 0; var strGen = '';			
	while(outLoop<thisLength)	{
		strGen += strChars.charAt(Math.round(Math.random() * strChars.length));
		outLoop++;
	}			
	return(strGen);
}

function validateEmail(email){
	 if (email.length == 0) return false; 
	 var splitted = email.match("^(.+)@(.+)$");
	 if(splitted == null) return false;
	 if(splitted[1] != null )
	 {
		var regexp_user=/^\"?[\w-_\.]*\"?$/;
		if(splitted[1].match(regexp_user) == null) return false;
	 }
	 if(splitted[2] != null)
	 {
		var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
		if(splitted[2].match(regexp_domain) == null) 
		{
		 var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
		 if(splitted[2].match(regexp_ip) == null) return false;
		}// if
		return true;
	 }
	return false;
}	

function spinner(divId){
    $(divId).update('<div style="margin:30px 0px;text-align:center;"><img src="/img/activity_spinners/spinner_3.gif" alt="Loading..." /></div>');
}

function processor(divId){
	$(divId).update('<img src="/img/activity_spinners/loading_animation_liferay.gif" width="70" height="10" style="margin-left:20px" alt="Processing..." />');
}


		function clearText(thefield){
			if (thefield.defaultValue==thefield.value)
			thefield.value = ""
			theField.style.color = "#333333"; 
		}
		function fillText(thefield){
			if (thefield.value==""){
				if(thefield.id == "password")
					thefield.value = "password"
				else 
					thefield.value = "login name"
			}
			theField.style.color = "#999999"; 
		}
		
    function showVid(url,width,height) {
    	if(url != 'player'){
        	href = '/example/'+url+'.asp';
        }else{
        	href = '/content/'+url+'.asp';
        }
        var rev = 'width:'+width+' height:'+height+' scrolling:no';
        fb.loadAnchor(href, rev);
    }
    function popupFS(url) {
        params = 'width=' + screen.width;
        params += ', height=' + screen.height;
        params += ', top=0, left=0'
        params += ', fullscreen=yes';

        window.open(url, 'windowname4', params);
        //if (window.focus) { newwin.focus() }
        return false;
    }
	    