function clearout()
{
	window.location = "http://www.clearoptimization.com/thank-you.html";
}

if(window.location == "http://www.clearoptimization.com/website-optimization.html" || window.location == "http://www.clearoptimization.com/dentist-website.html")
	{
	//window.location = "https://clearblu.ipower.com/clearoptimization/website-optimization.html";
	window.location = "http://www.clearoptimization.com/dentist-website-design.html";
	}

///if(window.location == "http://www.clearoptimization.com/dentist-website-design.html" || window.location == "http://www.clearoptimization.com/long-island/dentist-website-templates.html")
//	{
//	w = document.getElementById("mainheaderimg");
//	w.className = "mainheaderimgdental";
//	}
//if(window.location == "http://www.clearoptimization.com/long-island-seo.html")
//	{
//	w = document.getElementById("mainheaderimg");
//	w.className = "mainheaderimgecom";
//	}
//if(window.location == "http://www.clearoptimization.com/ecommerce-optimization.html")
//	{
//	w = document.getElementById("mainheaderimg");
//	w.className = "mainheaderimgseo";
//	}
if(window.location == "http://www.clearoptimization.com/contact-clear-optimization.html" || window.location == "http://www.clearoptimization.com/contact-clear-optimization.html#menulinks")
	{
	wh = document.getElementById("contactdiv");
	newval = '';


	newval += '<form onSubmit="return chemail()" method="post" name="websitecontact" action="/scripts/emailer.php">';
	newval += '<table border="0"><tr valign="top"><td>';
	newval += '<table border="0" cellspacing="0" cellpadding="0" style="width:150px; height:47px;"><tr><!--<td align="center"><span class="bot-text-p" style="float:center; margin-top:5px; font-weight:bold;">Call Now Toll-Free:</span><br><img title="1-800-516-4643" alt="1-800-516-4643" src="images/template/left-header-800-150.gif"></td></tr></table>';
	newval += '</td>--><td>';
	newval += '<span class="bot-text-p" style="float:center; margin-top:5px; font-weight:bold;">Your Message:</span><br><br><table border="0" cellspacing="0" cellpadding="0" class="inputtablecontact"><tr><td><span class="drformlabel" id="fname">Name:</span><br><input class="drforminputcontact" type="text" maxlength="75" name="drname"></td></tr></table>';
	newval += '<table border="0" cellspacing="0" cellpadding="0" class="inputtablecontact"><tr><td><span class="drformlabel" id="fname">E-Mail:</span><br><input class="drforminputcontact" maxlength="75" type="text" name="dremail"></td></tr></table>';
	newval += '<table border="0" cellspacing="0" cellpadding="0" class="inputtabletextarea"><tr><td><span class="drformlabel" id="fname">Message:</span><br><textarea class="drformtextarea" name="drmsg"></textarea></td></tr></table>';
	newval += '<table border="0" cellspacing="0" cellpadding="0" style="width:150px; height:47px;"><tr><td align="center"><input type="image" src="//www.clearoptimization.com/images/template/submit-button-150.gif"><input type="hidden" name="ksoff" value="onno"></td></tr></table>';
	newval += '</td></tr></table>';
	newval += '</form>';

	wh.innerHTML = newval;

	}
function chemail()
{
if((document.websitecontact.dremail.value.indexOf("@") == -1) || (document.websitecontact.dremail.value.indexOf(".") == -1))
	{document.websitecontact.dremail.focus();alert("Enter Email\nFormat: you@domain.com");return false;}
if((document.websitecontact.dremail.value.substring(document.websitecontact.dremail.value.length-3,document.websitecontact.dremail.value.length-2) != ".") && (document.websitecontact.dremail.value.substring(document.websitecontact.dremail.value.length-4,document.websitecontact.dremail.value.length-3) != "."))
	{document.websitecontact.dremail.focus();alert("Enter Email\nFormat: you@domain.com\nMust have 2 or 3 letter extension");return false;}
}

var u1 = 'off';
var u2 = 'off';
function updtr(wh)
	{
	if(wh == "99")
		{document.billform.billservice.value = "$39.99 per Month";}
	else
		{document.billform.billservice.value = "$399.99 per Year";}
	//billinfo.style.display = '';
	window.location = "#thensignup";
	}
function updtrname()
	{
	if(u2 == "off")
		{
		billnamediv.style.display = '';
		u2 = "on";
		th.billfname.value = "";
		th.billlname.value = "";
		th.billaddress.value = "";
		th.billcity.value = "";
		th.billzip.value = "";
		th.billstate.value = "";
		th.billemail.value = "";
		}
	else
		{billnamediv.style.display = 'none';
		u2 = "off";}		
	}
function bForm()
	{
	newval = "";
	//copy first form's websitecontact data
	for(i=0; i<document.websitecontact.elements.length; i++)
		{document.billform.elements["bf_"+document.websitecontact.elements[i].name].value = document.websitecontact.elements[i].value;}
	th = document.billform;
	if(th.chsameck.checked)
		{
		th.billfname.value = th.bf_drfname.value;
		th.billlname.value = th.bf_drlname.value;
		th.billaddress.value = th.bf_drstreet.value;
		th.billcity.value = th.bf_drcity.value;
		th.billzip.value = th.bf_drzip.value;
		th.billstate.value = th.bf_drstate.value;
		th.billemail.value = th.bf_dremail.value;
		
		if(th.billfname.value == "")
			{document.websitecontact.drfname.focus();alert("Enter First Name");return false;}
		if(th.billlname.value == "")
			{document.websitecontact.drlname.focus();alert("Enter Last Name");return false;}
		if(th.billaddress.value == "")
			{document.websitecontact.drstreet.focus();alert("Enter Address");return false;}
		if(th.billcity.value == "")
			{document.websitecontact.drcity.focus();alert("Enter City");return false;}
		if(th.billzip.value == "")
			{document.websitecontact.drzip.focus();alert("Enter Zip");return false;}
		if(th.billstate.value == "")
			{document.websitecontact.drstatesel.focus();alert("Enter State");return false;}
		if(th.billemail.value == "")
			{document.websitecontact.dremail.focus();alert("Enter Email");return false;}
		if((th.billemail.value.indexOf("@") == -1) || (th.billemail.value.indexOf(".") == -1))
			{document.websitecontact.dremail.focus();alert("Enter Email\nFormat: you@domain.com");return false;}
		if((th.billemail.value.substring(th.billemail.value.length-3,th.billemail.value.length-2) != ".") && (th.billemail.value.substring(th.billemail.value.length-4,th.billemail.value.length-3) != "."))
			{document.websitecontact.dremail.focus();alert("Enter Email\nFormat: you@domain.com\nMust have 2 or 3 letter extension");return false;}
		}
	else
		{
		if(th.billfname.value == "")
			{th.billfname.focus();alert("Enter First Name");return false;}
		if(th.billlname.value == "")
			{th.billlname.focus();alert("Enter Last Name");return false;}
		if(th.billaddress.value == "")
			{th.billaddress.focus();alert("Enter Address");return false;}
		if(th.billcity.value == "")
			{th.billcity.focus();alert("Enter City");return false;}
		if(th.billzip.value == "")
			{th.billzip.focus();alert("Enter Zip");return false;}
		if(th.billstate.value == "")
			{th.billstate.focus();alert("Enter State");return false;}
		if(th.billemail.value == "")
			{th.billemail.focus();alert("Enter Email");return false;}
		if((th.billemail.value.indexOf("@") == -1) || (th.billemail.value.indexOf(".") == -1))
			{th.billemail.focus();alert("Enter Email\nFormat: you@domain.com");return false;}
		if((th.billemail.value.substring(th.billemail.value.length-3,th.billemail.value.length-2) != ".") && (th.billemail.value.substring(th.billemail.value.length-4,th.billemail.value.length-3) != "."))
			{th.billemail.focus();alert("Enter Email\nFormat: you@domain.com\nMust have 2 or 3 letter extension");return false;}
		}
	if(th.billservice.value == "")
		{alert("Click Monthly or Yearly");return false;}
	if(th.ccnumber.value == "")
		{th.ccnumber.focus();alert("Enter Credit Card Number");return false;}
	if(th.cccode.value == "")
		{th.cccode.focus();alert("Enter Credit Card Code");return false;}
	//return false;
	}
////////////////////////////////

function wForm()
{

if(document.websitecontact.bustype.value == "")
	{document.websitecontact.bustype.focus();alert("Enter Business Type");return false;}
//if(document.websitecontact.bustype.value == "dental1" || document.websitecontact.bustype.value == "dental2")
	//{
	if(document.websitecontact.drfname.value == "")
		{document.websitecontact.drfname.focus();alert("Enter First Name");return false;}
	if(document.websitecontact.drlname.value == "")
		{document.websitecontact.drlname.focus();alert("Enter Last Name");return false;}
	if(document.websitecontact.pracname1.value == "")
		{document.websitecontact.pracname1.focus();alert("Enter Business Name");return false;}
	if(document.websitecontact.drphone.value == "")
		{document.websitecontact.drphone.focus();alert("Enter Phone Number");return false;}
	if((document.websitecontact.dremail.value.indexOf("@") == -1) || (document.websitecontact.dremail.value.indexOf(".") == -1))
		{document.websitecontact.dremail.focus();alert("Enter Email\nFormat: you@domain.com");return false;}
	if((document.websitecontact.dremail.value.substring(document.websitecontact.dremail.value.length-3,document.websitecontact.dremail.value.length-2) != ".") && (document.websitecontact.dremail.value.substring(document.websitecontact.dremail.value.length-4,document.websitecontact.dremail.value.length-3) != "."))
		{document.websitecontact.dremail.focus();alert("Enter Email\nFormat: you@domain.com\nMust have 2 or 3 letter extension");return false;}
	if(document.websitecontact.drstreet.value == "")
		{document.websitecontact.drstreet.focus();alert("Enter Address");return false;}
	if(document.websitecontact.drcity.value == "")
		{document.websitecontact.drcity.focus();alert("Enter City");return false;}
	if(document.websitecontact.drzip.value == "")
		{document.websitecontact.drzip.focus();alert("Enter Zip");return false;}
	if(document.websitecontact.drstate.value == "")
		{document.websitecontact.drstatesel.focus();alert("Enter State");return false;}
	//}
//return false;
}

function switchImg()
{
wh = document.getElementById("templateimg");
whsel = document.getElementById("bustype");

if(whsel.value == "dental1")
	{wh.src = "clean-examples/small-site-previews/site2.jpg";}
if(whsel.value == "dental2")
	{wh.src = "clean-examples/small-site-previews/site6.jpg";}
if(whsel.value == "dental3")
	{wh.src = "clean-examples/small-site-previews/site4.jpg";}
if(whsel.value == "dental4")
	{wh.src = "clean-examples/small-site-previews/site1.jpg";}
if(whsel.value == "dental5")
	{wh.src = "clean-examples/small-site-previews/site7.jpg";}
if(whsel.value == "dental6")
	{wh.src = "clean-examples/small-site-previews/site5.jpg";}

if(whsel.value == "dental7")
	{wh.src = "clean-examples/small-site-previews/site50.jpg";}
if(whsel.value == "dental8")
	{wh.src = "clean-examples/small-site-previews/site51.jpg";}
if(whsel.value == "dental9")
	{wh.src = "clean-examples/small-site-previews/site52.jpg";}
if(whsel.value == "dental10")
	{wh.src = "clean-examples/small-site-previews/site53.jpg";}
if(whsel.value == "dental11")
	{wh.src = "clean-examples/small-site-previews/site54.jpg";}
if(whsel.value == "dental12")
	{wh.src = "clean-examples/small-site-previews/site55.jpg";}
if(whsel.value == "dental13")
	{wh.src = "clean-examples/small-site-previews/site56.jpg";}
if(whsel.value == "dental14")
	{wh.src = "clean-examples/small-site-previews/site57.jpg";}
if(whsel.value == "dental15")
	{wh.src = "clean-examples/small-site-previews/site58.jpg";}
if(whsel.value == "dental16")
	{wh.src = "clean-examples/small-site-previews/site59.jpg";}
if(whsel.value == "dental17")
	{wh.src = "clean-examples/small-site-previews/site60.jpg";}
if(whsel.value == "dental18")
	{wh.src = "clean-examples/small-site-previews/site61.jpg";}


if(whsel.value == "industrial1")
	{wh.src = "clean-examples/small-site-previews/site3.jpg";}
if(whsel.value == "industrial2")
	{wh.src = "clean-examples/small-site-previews/site13.jpg";}
if(whsel.value == "lawyer1")
	{wh.src = "clean-examples/small-site-previews/site8.jpg";}
if(whsel.value == "lawyer2")
	{wh.src = "clean-examples/small-site-previews/site9.jpg";}
if(whsel.value == "lawyer3")
	{wh.src = "clean-examples/small-site-previews/site10.jpg";}
if(whsel.value == "lawyer4")
	{wh.src = "clean-examples/small-site-previews/site11.jpg";}
if(whsel.value == "lawyer5")
	{wh.src = "clean-examples/small-site-previews/site12.jpg";}
if(whsel.value == "industrial3")
	{wh.src = "clean-examples/small-site-previews/site25.jpg";}
if(whsel.value == "chiro1")
	{wh.src = "clean-examples/small-site-previews/site20.jpg";}
if(whsel.value == "chiro2")
	{wh.src = "clean-examples/small-site-previews/site21.jpg";}
if(whsel.value == "misc1")
	{wh.src = "clean-examples/small-site-previews/site16.jpg";}
if(whsel.value == "misc2")
	{wh.src = "clean-examples/small-site-previews/site17.jpg";}
if(whsel.value == "misc3")
	{wh.src = "clean-examples/small-site-previews/site23.jpg";}
if(whsel.value == "misc4")
	{wh.src = "clean-examples/small-site-previews/site18.jpg";}
if(whsel.value == "misc5")
	{wh.src = "clean-examples/small-site-previews/site19.jpg";}
if(whsel.value == "misc6")
	{wh.src = "clean-examples/small-site-previews/site33.jpg";}
if(whsel.value == "doctor1")
	{wh.src = "clean-examples/small-site-previews/site30.jpg";}
if(whsel.value == "doctor2")
	{wh.src = "clean-examples/small-site-previews/site35.jpg";}
if(whsel.value == "doctor3")
	{wh.src = "clean-examples/small-site-previews/site34.jpg";}
if(whsel.value == "doctor4")
	{wh.src = "clean-examples/small-site-previews/site32.jpg";}
if(whsel.value == "doctor5")
	{wh.src = "clean-examples/small-site-previews/site36.jpg";}
if(whsel.value == "doctor6")
	{wh.src = "clean-examples/small-site-previews/site37.jpg";}
if(whsel.value == "doctor7")
	{wh.src = "clean-examples/small-site-previews/site40.jpg";}
if(whsel.value == "doctor8")
	{wh.src = "clean-examples/small-site-previews/site41.jpg";}
if(whsel.value == "doctor9")
	{wh.src = "clean-examples/small-site-previews/site42.jpg";}
if(whsel.value == "doctor10")
	{wh.src = "clean-examples/small-site-previews/site43.jpg";}
if(whsel.value == "doctor11")
	{wh.src = "clean-examples/small-site-previews/site44.jpg";}
if(whsel.value == "doctor12")
	{wh.src = "clean-examples/small-site-previews/site45.jpg";}
if(whsel.value == "doctor13")
	{wh.src = "clean-examples/small-site-previews/site46.jpg";}
if(whsel.value == "doctor14")
	{wh.src = "clean-examples/small-site-previews/site47.jpg";}
if(whsel.value == "doctor15")
	{wh.src = "clean-examples/small-site-previews/site48.jpg";}
if(whsel.value == "doctor16")
	{wh.src = "clean-examples/small-site-previews/site49.jpg";}
}
function chStateSel()
{
wh = document.getElementById("drstatesel");
whd = document.getElementById("drstate");
whd.value = wh.value;
if(wh.value == "Other")
	{whd.style.display = '';}
else
	{whd.style.display = 'none';}
}



/////////////////////////////////////////////////////////////////////////

var start = 1;
var last = 50;
var img2move2 = 0;
var leftimg = 1;
var middleimg = 2;
var rightimg = 3;

function randomizeMainImg()
{
var randomnumber=Math.floor(Math.random()*49);
//alert(randomnumber);
if(randomnumber < 3)
	{randomnumber = 3;}
//randomnumber = 3;
rightimg = randomnumber;
middleimg = rightimg - 1;
leftimg = middleimg - 1;
moveLeftImgRight();
moveMiddleImgRight();
moveRightImgRight();

}

function moveLeftImgLeft()
{
if(leftimg == last)
	{leftimg = start;}
else
	{leftimg++}
w = document.getElementById("siteprevleft");
w2s = "http://www.clearoptimization.com/images/dental/dental-websites-back/s";
w2s += leftimg;
w2s += ".jpg";
w.src = w2s;
}

function moveMiddleImgLeft()
{
if(middleimg == last)
	{middleimg = start;}
else
	{middleimg++}
w = document.getElementById("siteprevmid");
w2s = "http://www.clearoptimization.com/images/dental/dental-websites-front/s";
w2s += middleimg;
w2s += ".jpg";
w.src = w2s;
}

function moveRightImgLeft()
{
if(rightimg == last)
	{rightimg = start;}
else
	{rightimg++}
w = document.getElementById("siteprevright");
w2s = "http://www.clearoptimization.com/images/dental/dental-websites-back/s";
w2s += rightimg;
w2s += ".jpg";
w.src = w2s;
}

function moveLeftImgRight()
{
if(leftimg == start)
	{leftimg = last;}
else
	{leftimg--}
w = document.getElementById("siteprevleft");
w2s = "http://www.clearoptimization.com/images/dental/dental-websites-back/s";
w2s += leftimg;
w2s += ".jpg";
w.src = w2s;
}

function moveMiddleImgRight()
{
if(middleimg == start)
	{middleimg = last;}
else
	{middleimg--}
w = document.getElementById("siteprevmid");
w2s = "http://www.clearoptimization.com/images/dental/dental-websites-front/s";
w2s += middleimg;
w2s += ".jpg";
w.src = w2s;
}

function moveRightImgRight()
{
if(rightimg == start)
	{rightimg = last;}
else
	{rightimg--}
w = document.getElementById("siteprevright");
w2s = "http://www.clearoptimization.com/images/dental/dental-websites-back/s";
w2s += rightimg;
w2s += ".jpg";
w.src = w2s;
}

function moveImgsLeft()
{
//subtracting
moveLeftImgLeft();
moveMiddleImgLeft();
moveRightImgLeft();
}

function moveImgsRight()
{
//adding
moveLeftImgRight();
moveMiddleImgRight();
moveRightImgRight();
}

randomizeMainImg();
