var currentPage = "";
var currentOpacity = 10;
var intervalID;
var previousPage = "";
var subtab = "";
//var home_text = "<p class='subtitle'>WELCOME TO ROYAL CONNECTION, INC.</p><p>The company that is prepared to provide tta solutions to your organization's needs.</p><br><br><br><p><span class='subsubtitle'>Claudette Haynes,</span><i class='innertitle'> President</i></p><br><p class='innertitle'>RCI is:</p><ul><li>8(a) Certified</li><li>A Woman-Owned Business</li></ul>";
var home_text = "";
var about_text = "<p class='subtitle'>ABOUT US</p><p>Having had more than twenty five (25) years of experience in Business Management,<br>Claudette Haynes established Royal Connection Inc. in 2002.</p><br><p>RCI provides total solutions to manage the complex operations of:</p><ul><li>Government Agencies</li><li>Private Companies and</li><li>Non-profit Organizations</li></ul><br><p>We bring together professional teams with quality tools that include:</p><div style='width: 580px;'><div class='tddiv' style='width: 220px;'><ul><li>Recruitment</li><li>Training</li><li>Operating Procedures</li></ul></div><div class='tddiv' style='width: 360px;'><ul><li>Operations Monitoring</li><li>Quality Assurance</li><li>Performance Measurement</li></ul></div></div><p>&nbsp;</p><p>At Royal Connection Inc., we also have a unique blend of expertise which enables the company to meet the requirements of clients.</p>";
var vision_text = "<p class='subtitle'>VISION</p><p>The vision of Royal Connection Inc. is to be a leader in innovation, integration of financial operations and information technologies for:</p><ul><li>Government</li><li>Private Companies</li><li>Non-Profit Organizations</li></ul><br><p>Our primary goals are to operate ethically and to be respected by all customers.</p><br><p>Our aim is to leave our clients with continuous results and benefits through our involvement with:</p><ul><li>Project recommendations</li><li>Implementation strategies</li><li>Skills transfer</li></ul>";
var assurance_text = "<p class='subtitle'>ASSURANCE</p><p>We assure each client:</p><br><ul><li>Strong leadership of an experienced professional who will<br>manage the project to its completion</li><li>Services tailored to meet their specific needs and circumstances</li><li>Staffing of each assignment with qualified professionals</li><li>Treatment of your information with complete confidentiality</li><li>Completion of all projects on schedule, within budget and to your satisfaction</li></ul>";
var services_text = "<p class='subtitle'>SERVICES</p><p>Royal Connection, Inc., specializes in the following services:</p><br><p class='subsubtitle'>Accounting & Financial Management</p><ul class='removebullet'><li>Up-grading Internal Controls</li><li>Voucher Examination</li><li>Compliance Audit</li><li>Management of Accounting functions (GL, AP, A/R, etc.)</li><li>Review of Financial Operations</li></ul><br><p class='subsubtitle'>Information Technology</p><ul class='removebullet'><li>Help Desk/User Support</li><li>Network Operations (LAN, MAN, WAN)</li><li>Network Engineering</li><li>Enterprise Planning and Project Management Office</li><li>Systems Security</li><li>Disaster Recovery/Contingency Planning</li><li>Database Development and Administration</li><li>Staff Augmentation</li></ul><br><p class='subsubtitle'>Management Consulting</p><ul class='removebullet'><li>Policy and Procedure Development</li><li>Quantitative Analysis Techniques</li><li>Risk Analyses</li><li>Strategic Alternatives</li></ul>";
var clients_text = "<p class='subtitle'>CLIENTS</p><br><p class='subsubtitle'>Federal</p><ul><li>Department of Housing and Urban Development</li><li>Department of Labor</li><li>Department of Environmental Protection Agency</li></ul><br><br><p class='subsubtitle'>Non-Federal</p><ul><li>Cannings Investments</li></ul>";
var careers_text = "<p class='subtitle'>CAREERS</p><p>Royal Connection, Inc. is an equal opportunity employer and is looking for qualified professionals and skilled individuals to add to its team.  If interested, please forward your information by using <span onmouseover='setCursor(this);' style='color: #800080; font-weight: bold; text-decoration: underline;' onclick='openResume();' id='resume_link'>Upload Resume</span>.  Please use Microsoft Word format that include:</p><ul><li>Name</li><li>Address</li><li>Phone/Fax/Email</li><li>Education and other training</li><li>Experience</li></ul><br><p>We are seeking professionals with these qualifications</p><p class='subsubtitle'>Education:</p><ul><li>Computer Information Systems</li><li>Systems Engineering</li><li>BS Accounting</li><li>MBA</li><li>BS Information Systems Management</li><li>Certified Public Accounting</li><li>Bachelor’s Degree in Business Management with 24 semester hours<br>in Accounting</li><li>Equivalent work experience will be considered</li></ul><br><p class='subsubtitle'>Skills:</p><ul><li>Excellent Communication</li><li>Knowledge of Computer Applications</li><li>Application Level Software Installation and Maintenance</li><li>Information Systems</li><li>Compliance, Operations and Performance Audit</li><li>Contract, Grants and Cost Proposal Audits</li><li>Independent Government Cost Estimates</li><li>Cost/Benefit Analysis and Projections</li><li>Electronic Data Processing (EDP) Audits</li><li>Transaction Analysis and Claims Examination</li><li>Accounting and Budget Tracking System Design and Installation</li><li>Voucher Examination and Vendor Pay services</li></ul>";
var careersresume_text = "<p class='subtitle'>Upload Resume</p><br><form name='form1' method='post' enctype='multipart/form-data' action='careers.php' onSubmit='return validate(this)' ><table width='323' border='0' cellpadding='0' cellspacing='0'><tr><td colspan='3'>&nbsp;</td></tr><tr><td width='76' height='30' class='style1'>Name</td><td colspan='2'><input type='text' name='name' class='a1' id='name'></td></tr><tr><td class='style1'>Phone</td><td height='30' colspan='2'><input type='text' name='phone' class='a1' id='phone' /></td></tr><tr><td class='style1'>Email</td><td height='30' colspan='2'><input type='text' class='a1' name='email' id='email' /></td></tr><tr><td class='style1'>Resume</td><td colspan='2'><input type='file'  name='fileField' id='fileField'></td></tr><tr><td>&nbsp;</td><td colspan='2'>&nbsp;</td></tr><tr><td><divalign='center'></div></td><td width='78'><img src='images/sub.jpg' width='73' height='21' onclick='validate();' onMouseOver='setCursor(this);' /></td><td width='169'><img src='images/reset.jpg' width='73' height='21' onclick='javascript:document.form1.reset();' onMouseOver='setCursor(this);' /></td></tr></table><p>&nbsp;</p></form>";
var contactus_text = "<p class='subtitle'>CONTACT US</p><br><form name='form1' method='post' enctype='multipart/form-data'action='contact.php' onSubmit='return validate(this)' ><table width='400' border='0' cellpadding='0' cellspacing='0'><tr><td width='91' valign='top' class='style8 style2'>Name</td><td colspan='3' class='style8'><div align='left'><input type='text' name='name' id='name' class='a' /></div></td></tr><tr><td colspan='4' class='style8'>&nbsp;</td></tr><tr><td class='style8 style2'>Email</td><td colspan='3' class='style8'><div align='left'><input type='text' name='email' id='email' class='a'/></div></td></tr><tr><td colspan='4' class='style8'>&nbsp;</td></tr><tr><td class='style2'>Phone</td><td colspan='3' class='style8'><input type='text' name='phone' id='phone' class='a'/></td>  </tr><tr><td height='19' valign='top' class='style2'>&nbsp;</td><td colspan='3' class='style8'>&nbsp;</td></tr><tr><td height='86' valign='top' class='style2'>Comments</td><td colspan='3' class='style8'><label><textarea name='comments' cols='30' rows='7' wrap='virtual' id='comments' class='a'></textarea></label></td></tr><tr><td colspan='4'class='style8'>&nbsp;</td></tr><tr><td>&nbsp;</td><td width='73'><img src='images/sub.jpg' width='73' height='21' onclick='validate();' onMouseOver='setCursor(this);' /></td><td width='207'><img src='images/reset.jpg' width='73' height='21'  onclick='javascript:document.form1.reset();' onMouseOver='setCursor(this);'/></td><td width='29'><div align='center'></div></td></tr><tr><td colspan='4'>&nbsp;</td></tr></table></form>";

function setPos()
{
var bodyWidth = document.body.clientWidth;
if (bodyWidth > 990)
document.getElementById("maincontainer").style.marginLeft = (bodyWidth - 990)/2 + "px";
if (currentPage == "")
{
currentPage = "home";	
openPage("home");
}
}

function setCursor(obj)
{
	obj.style.cursor = "pointer";	
}

function setImg(obj)
{
obj.src = "images/button/RCI-" + obj.id + "_change.jpg";
}

function resetImg(obj)
{
if (obj.id != currentPage)
obj.src = "images/button/RCI-" + obj.id + ".jpg";
}

function setCursor(obj)
{
obj.style.cursor = "pointer";
}

function openPage(fileUrl)
{
/*	if (fileUrl == "home")
	{
		//document.getElementById("generaldiv").style.display = "none";
		document.getElementById("servicesdiv").style.display = "none";
		document.getElementById("indexdiv").style.display = "block";		
	}
	else
	{
		document.getElementById("indexdiv").style.display = "none";
		document.getElementById("servicesdiv").style.display = "block";
	//	document.getElementById("generaldiv").style.display = "inline";		
	}*/
	
previousPage = currentPage;
 if (fileUrl == "careers_resume")
 {
currentPage = "careers";
subtab = "resume";
 }
 else
 {
currentPage = fileUrl;
subtab = "";
 }

var flashheader = document.getElementById("flash_header").innerHTML;
document.getElementById("flash_header").innerHTML = flashheader;
resetImg(document.getElementById("home"));
resetImg(document.getElementById("about"));
resetImg(document.getElementById("vision"));
resetImg(document.getElementById("assurance"));
resetImg(document.getElementById("services"));
resetImg(document.getElementById("clients"));
resetImg(document.getElementById("careers"));
resetImg(document.getElementById("contactus"));

resetColor(document.getElementById("home_footer"));
resetColor(document.getElementById("about_footer"));
resetColor(document.getElementById("vision_footer"));
resetColor(document.getElementById("assurance_footer"));
resetColor(document.getElementById("services_footer"));
resetColor(document.getElementById("clients_footer"));
resetColor(document.getElementById("careers_footer"));
resetColor(document.getElementById("contactus_footer"));

setImg(document.getElementById(currentPage));
setColor(document.getElementById(currentPage + "_footer"));
decreaseOpacity();
}

function openResume()
{
openPage("careers_resume");
}

function decreaseOpacity()
{
    var ctnContainer = document.getElementById("contentContainer");
    var mdl_first = document.getElementById("middle_first");
	var index_div = document.getElementById("indexdiv");
	
    //var topimg = document.getElementById("top_img");
    
    currentOpacity = currentOpacity - 1;
    
    if (currentOpacity == 10)
    {
		if (previousPage != "home")
		{
        ctnContainer.style.opacity = "1";
        mdl_first.style.opacity = "1";
		}
		else
		{
		index_div.style.opacity = "1";	
		}
    }    
    else
    {
		if (previousPage != "home")
		{
        ctnContainer.style.opacity = "0." + currentOpacity;
        mdl_first.style.opacity = "0." + currentOpacity;
		}
		else
		{
		index_div.style.opacity = "0." + currentOpacity;		
		}
     }
  
  	if (previousPage != "home")
	{
    ctnContainer.style.filter = "alpha(opacity=" + currentOpacity + "0)";
    mdl_first.style.filter = "alpha(opacity=" + currentOpacity + "0)";
	}
	else
	{
	index_div.style.filter = "alpha(opacity=" + currentOpacity + "0)";	
	}
    
    if (currentOpacity > 0)
    {
    window.clearTimeout (intervalID);
    intervalID = window.setTimeout ( "decreaseOpacity()", 100); 
    }
    else
    {
	  if ( currentPage != "home")
	  {
		document.getElementById("indexdiv").style.display = "none";
		document.getElementById("servicesdiv").style.display = "block";
		
		if (currentPage == "clients")
		{
			document.getElementById("contentContainer").style.width = "400px";			
		}
		else
		{
			document.getElementById("contentContainer").style.width = "580px";						
		}
	  }
	else	  
	  {
		  document.getElementById("indexdiv").style.display = "block";
		  document.getElementById("servicesdiv").style.display = "none";
	  }

	if (currentPage != "home")
	{
		if (subtab == "")
    ctnContainer.innerHTML = eval(currentPage + "_text");    
	else
	ctnContainer.innerHTML = eval (currentPage + "resume_text");
	
	/*if ((currentPage == "careers") && (subtab == ""))
	document.getElementById("resume_link").style.display = "block";
	else
	document.getElementById("resume_link").style.display = "none";*/
		
	
	if (ctnContainer.offsetHeight < 423 )
	mdl_first.style.height = "423px";
	else
	mdl_first.style.height = ctnContainer.offsetHeight + "px";

//	alert (ctnContainer.offsetHeight);
	mdl_first.style.backgroundImage = "url('images/" + currentPage + "_first.jpg')";

	
	 if (currentPage != 'clients')
	{
	mdl_first.style.backgroundImage = "url('images/" + currentPage + "_first.jpg')";
	document.getElementById("middle_first_inner").style.display = "none";
	}
	else
	{
//	mdl_first.style.backgroundImage = "none";
	document.getElementById("middle_first_inner").style.display = "inline";
	}   
	}    
    /*if (currentPage == "home")
    topimg.style.backgroundImage = "url('images/" + currentPage + "_top.jpg')";
    else
    topimg.style.backgroundImage = "url('images/common_top.jpg')";*/
    increaseOpacity();
    }
       
}

function increaseOpacity()
{
    var ctnContainer = document.getElementById("contentContainer");
	var mdl_first = document.getElementById("middle_first");
	var index_div = document.getElementById("indexdiv");
    
    currentOpacity = currentOpacity + 1;
    
    if (currentOpacity == 10)
    {
		if (currentPage != "home")
		{
        ctnContainer.style.opacity = "1";
        mdl_first.style.opacity = "1";
		}
		else
		{
		index_div.style.opacity = "1";	
		}
    }    
    else
    {
		if (currentPage != "home")
		{
        ctnContainer.style.opacity = "0." + currentOpacity;
        mdl_first.style.opacity = "0." + currentOpacity;
		}
		else
		{
		index_div.style.opacity = "0." + currentOpacity;	
		}
     }
  
  	if (currentPage != "home")
	{
    ctnContainer.style.filter = "alpha(opacity=" + currentOpacity + "0)";
    mdl_first.style.filter = "alpha(opacity=" + currentOpacity + "0)";
	}
	else
	{
		index_div.style.filter = "alpha(opacity=" + currentOpacity + "0)";
	}
    
    if (currentOpacity < 10)
    {
    window.clearTimeout ( intervalID);
    intervalID = window.setTimeout ( "increaseOpacity()", 100); 
    }

}

function setUnderline(obj)
{
obj.style.textDecoration = "underline";
}

function resetUnderline(obj)
{
obj.style.textDecoration = "none";
}

function setColor(obj)
{
obj.style.color = "#800080"
}

function resetColor(obj)
{
if (obj.id != (currentPage + "_footer"))
obj.style.color = "#353535"
}

function validate()
	{
	
 if( check()==true)
 {
 document.form1.submit();
 }
	
	}
	
function check()
	{
			if ((document.form1.name.value=="") || (document.form1.email.value==""))
		{
			alert("Please, Enter all Mandatory Fields");
			return false;
		}	
		var emailID=document.form1.email
	
		if ((emailID.length>0)||(emailID.value!=""))
		{
			if (echeck(emailID.value)==false)
			{
				emailID.value=""
				emailID.focus()
				return false
			}
		}
	
	return true;
	}
	
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}	
