function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function openNewScrolledWindow(target, sizeX, sizeY) {
	LeftPosition = (screen.width) ? (screen.width-sizeX)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-sizeY)/2 : 0;
	window.open(target,'_blank','menubar=false,scrollbars=yes,resizable=yes,top='+TopPosition+',left='+LeftPosition+',width='+sizeX+',height='+sizeY);
}
function openNewWindow(target, sizeX, sizeY) {
	LeftPosition = (screen.width) ? (screen.width-sizeX)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-sizeY)/2 : 0;
	window.open(target,'_blank','toolbar=no,menubar=no,scrollbars=no,resizable=yes,top='+TopPosition+',left='+LeftPosition+',width='+sizeX+',height='+sizeY);
}	
function reloadWindow(){
	window.opener.location.reload();
}
function confirmSubmission(msg){
	if (confirm(msg) == true)
		return true;
	else
		return false;
}
function getCurrentYear(){
	var d = new Date();
	return(d.getFullYear());
}
function getYearsEstablished(){
	return('1986');
}
function getYearsExperience(){
	//Set the two dates
	var startingdate=new Date(1981, 1, 1) // Founded: February 1980 but we'll use February, 1981 in calculation (Month is 0-11 in JavaScript)
	var today=new Date()
	
	//Get 1 day in milliseconds
	var one_day=1000*60*60*24
	var one_year=one_day*365
	
	//Calculate difference btw the two dates, and convert to days
	var year_exp = Math.ceil((today.getTime()-startingdate.getTime())/(one_year))
	
	return year_exp;
}
function getURL(strURL,isSSL) {
	var strProtocol = document.location.protocol;//IE "http" NN "http:"
	var strRight = "";
	var strFullURL = "";
	var strCurrentURL = document.location.hostname;
	var iLen = strCurrentURL.length;
	
	if (strProtocol == "http")	//IE "http"
		strProtocol = "http:";
	else if (strProtocol == "https")	//IE "https"
		strProtocol = "https:";
	
	if (iLen >= 3)
		strRight = strCurrentURL.substring(iLen, iLen - 4); //check if prod box --> ".com"

	//alert(strProtocol += "//www.creatingfamilies.com");
	
	//if some page on Prod need https
	if (isSSL == "true"){ 
		if (strRight == ".com")
		strProtocol = "https:";
	}
	if (isSSL == "false"){ 
		if (strRight == ".com")
		strProtocol = "http:";
	}
	
	if (strRight == ".com")
		strProtocol += "//www.creatingfamilies.com";
	else
		strProtocol = "..";	//test box
	
	strFullURL = strProtocol + strURL;
	
	document.location.href = strFullURL;
	
	return true;
}
function fullScreen(theURL) {
    window.open(theURL, '', 'fullscreen=yes, scrollbars=auto'); 
}
