isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie

function FlaVer(){
	for (var i=0; i<10; i++){
		try{
			ver = 10-i;
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + ver.toString());
			version = axo.GetVariable("$version");
			if (version){
				return ver;
			}
		}catch(er){
			
		}
	}
	return 0;
}

function MoviePlayer(path,paused){
	var flaver = FlaVer();
	var fvars = 'direct=' + path + (paused ? '&paused=true' : '');
	var swfobj = new String();
	if (flaver == 7){
		swfobj = '<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="346" height="326"><param name="movie" value="/swf/player7.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="7.0.70.0" /><param name="expressinstall" value="Scripts/expressInstall.swf" /><param name="FlashVars" value="' + fvars + '" /><object type="application/x-shockwave-flash" data="swf/player7.swf" width="346" height="326"><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="7.0.70.0" /><param name="expressinstall" value="/Scripts/expressInstall.swf" /><param name="FlashVars" value="' + fvars + '" /></object></object>';
	}else if (flaver == 8){
		swfobj = '<object id="FlashID2" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="240"><param name="movie" value="/swf/player8.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="8.0.35.0" /><param name="expressinstall" value="/Scripts/expressInstall.swf" /><param name="FlashVars" value="' + fvars + '" /><object type="application/x-shockwave-flash" data="/swf/player8.swf" width="320" height="240"><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="8.0.35.0" /><param name="expressinstall" value="/Scripts/expressInstall.swf" /><param name="FlashVars" value="' + fvars + '" /></object></object>';
	}else{
		swfobj = '<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="320" height="240"><param name="movie" value="/swf/flex3/rwplayer.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="/Scripts/expressInstall.swf" /><param name="FlashVars" value="' + fvars + '" /><object pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" data="/swf/flex3/rwplayer.swf" width="320" height="240"><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="/Scripts/expressInstall.swf" /><param name="FlashVars" value="' + fvars + '" /><div><h4>Content on this page requires a newer version of Adobe Flash Player.</h4><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p></div></object></object>';
	}
	document.write(swfobj);
}

function handleGoupCheck(obj){
	var objs = document.getElementsByName(obj.name);
	if (objs.length > 1){
		for (var i=0; i<objs.length; i++){
			if (objs[i] == obj){
				if (i == 0){
					for (var j=1; j<objs.length; j++){
						objs[j].checked = false;
					}
				}else{
					objs[0].checked = false;
				}
				break;
			}
		}
	}
}

function linkwindow(url) {
    window.open(url,"linkwin");
	return false;
}

function emailPage(popup){
	if (popup){
		var url = new String(document.location);
		popwindow('http://' + location.hostname + '/emailme.php?page=' + encodeURL(url),'emailpage',360,555);
	}else{
		try{
			document.write('<a href="javascript:;" onclick="emailPage(true);"><img src="/images/email.gif" alt="Email This Page" width="15" height="9" align="left" style="padding-top:2px;" />Email Page</a>');
		}catch(er){
			//alert(er);
		}
	}
}

function stepHighlight(steps,step){
	var div;
	for (var i=1; i<=steps; i++){
		div = document.getElementById('stepdiv' + i);
		if (i == step){
			div.className = "stepon";
			div.style.background = "url(images/step" + i + "-on.jpg) left no-repeat";
		}else{
			div.className = "stepoff";
			div.style.background = "url(images/step" + i + "-off.jpg) left no-repeat";
		}
	}
}

function AddSorter(oreo){
	thiscookie = document.cookie;
	if (thiscookie.indexOf("sb=" + oreo + "a") > -1){
		imga = 'images/s_asc.png';
		imgd = 'images/s_desc_g.png'
	}else if (thiscookie.indexOf("sb=" + oreo + "d") > -1){
		imga = 'images/s_asc_g.png';
		imgd = 'images/s_desc.png'
	}else{
		if (oreo == 'model'){
			imga = 'images/s_asc.png';
		}else{
			imga = 'images/s_asc_g.png';
		}
		imgd = 'images/s_desc_g.png'
	}
	document.write('<a href="javascript:;" title="Sort Ascending" onclick="return RunSBSort(\'' + oreo + 'a\')"><img src="' + imga + '" width="11" height="9" border="0" /></a><a href="javascript:;" title="Sort Descending" onclick="return RunSBSort(\'' + oreo + 'd\')"><img src="' + imgd + '" width="11" height="9" border="0" /></a>');
}

function RunSBSort(oreo){
	document.cookie = "sb=" + oreo;
	window.location.reload();
	return true;
}

function SetPage(base,int,srch){
	var gvars = new Array();
	if (int > 1){
		gvars[gvars.length] = "page=" + int;
	}
	if (srch){
		gvars[gvars.length] = "search=" + srch;
	}
	document.location = base + (gvars.length > 1 ? '?' + gvars.join('&') : '');
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

MM_preloadImages("/images/text-buysell_over.gif","/images/text-helpsupport_over.gif","/images/text-robotparts_over.gif","/images/text-robots_over.gif","/images/text-hotdeals_over.gif");

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function RW_swapImage(obj,id,path,maxwidth,maxheight){
	var thisthumb = obj.getElementsByTagName("IMG");
	var allthumbs = document.getElementsByTagName("IMG");
	for (var i=0; i<allthumbs.length; i++){
		if (allthumbs[i].style.borderColor != ''){
			allthumbs[i].style.borderColor = '#CCC';
		}
	}
	if (thisthumb[0].style.borderColor != ''){
		thisthumb[0].style.borderColor = '#C00';
	}
	
	if (!maxwidth){
		maxwidth = 800;
	}
	if (!maxheight){
		maxheight = 600;
	}
	
	var img = new Image();
	img.onload = function(){
		if (img.width > maxwidth){
			img.height = Math.ceil(img.height * (maxwidth/img.width));
			img.width = maxwidth;
		}
		if (img.height > maxheight){
			img.width = Math.ceil(img.width * (maxheight/img.height));
			img.height = maxheight;
		}
		try{
			document.getElementById(id).src = path;
			document.getElementById(id).width = img.width;
			document.getElementById(id).height = img.height;
			document.getElementById(id).parentNode.onclick = obj.onclick;
		}catch(er){
			//alert(er);
		}
	}
	img.src = path;
}

function popwindow(url,winname,w,h) {
    window.open(url,winname,"toolbar=no,status=no,resizable=no,scrollbars=yes,menubar=no,width=" + w + ",height=" + h);
}

function cellImg(idCell, imgName) { 
	//top.document.all[idCell].style.background = "url(" + imgName + ")";
	top.document.all[idCell].style.background = "url(images/" + imgName + ") background-repeat no-repeat background-position top center";
}

function GoToLink(url){
	if (window.location.href.indexOf('u=http://www.robots.com') == -1){
		window.location.href = url;
	}else{
		if (url.indexOf('/') == 0){
			url = url.substr(1);
		}
		var thisurl = window.location.href;
		thisurl = thisurl.replace(/([\?\&]?)u=[^\?\&]+([\?\&]?)/gi,'$1u=http://www.robots.com/' + encodeURL(url) + '$2');
		window.location.href = thisurl;
	}
}

function GoogleTrans(lang){
	try{
		top.document.location = "http://translate.google.com/translate?hl=" + lang + "&sl=en&u=http://www.robots.com/";
	}catch(er){
		document.location = "http://translate.google.com/translate_c?hl=" + lang + "&sl=en&u=http://www.robots.com/";
	}
}

function encodeURL(str){
	chars = new Array("%","`","~","!","#","$","^","&","(",")","=","+","{","}","[","]","\\","|",";",":","'","\"",",","<",">","/","?","’"," ","—");
	ascii = new Array("%25","%60","%7E","%21","%23","%24","%5E","%26","%28","%29","%3D","%2B","%7B","%7D","%5B","%5D","%5C","%7C","%3B","%3A","%27","%22","%2C","%3C","%3E","%2F","%3F","%92","+","%97");
	enc = str;
	for(j=0; j<chars.length; j++){
		myRegExp = new RegExp("\\" + chars[j], "gi");
		enc = enc.replace(myRegExp,ascii[j]);
	}
	return enc;
}

function GetImagePath(path){
	var largePath = path.replace(/_tn.jpg/gi,".jpg");
	newwin = window.open("pic.htm","PicWin","toolbar=no,status=no,resizable=no,scrollbars=no,menubar=no,width=1,height=1");
	setTimeout("LoadPic('" + largePath + "')",100);
}

function LoadPic(path){
	if(newwin.complete){
		newwin.document.getElementById("picture").src = path;
	}else{
		setTimeout("LoadPic('" + path + "')",100);
	}
}

function setcookie(val){
	myDate = new Date();
	expDate = new Date(myDate.getFullYear()+1,myDate.getMonth(),myDate.getDate(),00,00,00);
	if (val == "Metric"){
		document.cookie = "mesu=0;expires=" + expDate.toGMTString() + ";";
	}else{
		document.cookie = "mesu=1;expires=" + expDate.toGMTString() + ";";
	}
	location.reload();
}

var formflag = 0;
function dataMiner(){
	if(formflag == 0){
		formflag = 1;
		if (document.getElementById("Submit")){
			document.getElementById("Submit").value = "Wait...";
			document.getElementById("Submit").disabled = true;
		}
		if (document.getElementById("Reset")){
			document.getElementById("Reset").disabled = true;
		}
		return true;
	}
}

var http = createRequestObject();
function createRequestObject(){
	var req;
	if(window.XMLHttpRequest){
		// Firefox, Safari, Opera...
		req = new XMLHttpRequest();
	} else if(window.ActiveXObject){
		// Internet Explorer 5+
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return req;
}

function ApplicationRobots(mtag,application){
	if (document.getElementById('mfg_' + mtag).innerHTML.indexOf('>View Models<') != -1){
		document.getElementById('view_' + mtag).innerHTML = '<a href="javascript:;" onclick="ApplicationRobots(' + mtag + ',\'' + application + '\');">View Models</a> <img src="/images/thinking.gif" border="0" width="17" height="18" align="texttop" />';
		var http = createRequestObject();
		http.open('get', location.pathname + '?ajax=true&application=' + encodeURL(application) + '&mfg=' + mtag);
		http.onreadystatechange = function(){
			if(http.readyState == 4 && http.status == 200){
				var html = http.responseText;
				if (html == 'error'){
					
				}else{
					var obj = document.getElementById('highlightDiv');
					var divs = obj.getElementsByTagName("DIV");
					for (var i=0; i<divs.length; i++){
						if (divs[i].id == 'div_' + mtag){
							divs[i].style.background = "url(images/highlight.png) center top no-repeat";
						}else{
							divs[i].style.background = "";
						}
					}
					obj = document.getElementById('displayDiv');
					divs = obj.getElementsByTagName("DIV");
					for (var i=0; i<divs.length; i++){
						if (divs[i].id.indexOf('mfg_') != -1){
							if (divs[i].id != 'mfg_' + mtag){
								var RegEx = /mfg_([\d]+)/i;
								var matches = RegEx.exec(divs[i].id);
								divs[i].innerHTML = '<div style="height: 50px; border-top: 1px solid #666;"><ul style="list-style-image: url(/images/textlinkbox_bullet.gif); margin-top: 18px;"><li id="view_' + matches[1] + '"><a href="javascript:;" onclick="ApplicationRobots(' + matches[1] + ',\'' + application + '\');">View Models</a></li></ul></div>';
							}
						}
						
					}
					document.getElementById('mfg_' + mtag).innerHTML = html;
				}
			}
		};
		http.send(null);
	}
}

function filterMovieList(val,type,field){
	http.open('get', location.pathname + '?ajax=true&' + type + '=' + (field ? field + ':' : '') + encodeURL(val));
	http.onreadystatechange = function(){
		if(http.readyState == 4 && http.status == 200){
			location.href = location.pathname;
		}
	};
	http.send(null);
}

function setMovieCookie(val){
	document.cookie = "moviecat=" + encodeURL(val);
	return true;
}

function MoreRelatedParts(mtag,model,controllers){
	http.open('get', '/parts.php?mtag=' + mtag + '&model=' + model + '&controllers=' + controllers);
	http.onreadystatechange = function(){
		if(http.readyState == 4 && http.status == 200){
			var html = http.responseText;
			document.getElementById("relparts").innerHTML = html;
		}
	};
	http.send(null);
}

function blogExpand(obj){
	var pobj = obj.parentNode.parentNode;
	var img = obj.getElementsByTagName('IMG');
	var divs = pobj.getElementsByTagName('DIV');
	
	if (divs.length == 3){
		//Collapse
		if (img.length > 0){
			img[0].style.background = "url(/images/plusminus.jpg) top no-repeat";
		}
		
		pobj.removeChild(divs[2]);
	}else{
		var RegEx = /blog_([\d]+)/i;
		var matches = RegEx.exec(pobj.id);
		http.open('get', '/blog.php?ajax=text&id=' + matches[1]);
		http.onreadystatechange = function(){
			if(http.readyState == 4 && http.status == 200){
				var html = http.responseText;
				if(html != 'error'){
					//Expand
					if (img.length > 0){
						img[0].style.background = "url(/images/plusminus.jpg) bottom no-repeat";
					}
					var ppobj = pobj.parentNode;
					var divs = ppobj.getElementsByTagName('DIV');
					for (var i=0; i<divs.length; i++){
						if (divs[i].id){
							var tempobjs = divs[i].getElementsByTagName('DIV');
							if (tempobjs.length == 3){
								var tempimg = tempobjs[0].getElementsByTagName('IMG');
								if (tempimg.length > 0){
									tempimg[0].style.background = "url(/images/plusminus.jpg) top no-repeat";
								}
								divs[i].removeChild(tempobjs[2]);
							}
						}
					}
					
					var div = document.createElement('DIV');
					div.style.styleFloat = 'right';
					div.style.width = '285px';
					div.style.paddingLeft = '15px';
					div.innerHTML = html;
					pobj.appendChild(div);
				}else{
					//alert('Error');
				}
			}
		};
		http.send(null);
	}
}

function BlogNav(obj){
	var pdiv = obj.parentNode;
	var images = obj.getElementsByTagName("IMG");
	for (var i=0; i<images.length; i++){
		var img = images[i];
	}
	if (img.src.indexOf("images/minus.gif") != -1){
		//Collapse menu
		var anchors = pdiv.getElementsByTagName("A");
		var html = '<a href="javascript:;" onclick="BlogNav(this);"><img src="/images/plus.gif" /></a> <a href="' + anchors[1].href + '">' + anchors[1].innerHTML + '</a>';
		pdiv.innerHTML = html;
	}else if (img.src.indexOf("images/plus.gif") != -1){
		//Expand Menu
		var results = location.search.match(/(\?|&)?tag=([\d]+)(\?|&)?/i);
		try{
			var tag = results[2];
		}catch(er){
			var tag = false;
		}
		http.open('get', '/blog.php?ajax=' + pdiv.id + (tag ? '&tag=' + tag : ''));
		http.onreadystatechange = function(){
			if(http.readyState == 4 && http.status == 200){
				var html = http.responseText;
				if(html != 'error'){
					pdiv.innerHTML = html;
				}
			}
		};
		http.send(null);
	}
}

function quickList(){
	http.open('get', '/functions.php?ajax=quicklist');
	http.onreadystatechange = function(){
		if(http.readyState == 4 && http.status == 200){
			// Text returned FROM PHP script
			var response = http.responseText;
			if(response){
				// UPDATE ajaxTest content
				if (isIE){
					document.getElementById("selector").outerHTML = '<select name="selector" id="selector" onchange="GoToLink(this.value)" style="width: 150px; font-size: 11px;">' + response + '</select>';
				}else{
					document.getElementById("selector").innerHTML = response;
				}
			}
		}
	};
	http.send(null);
}

function grabModels(mfg){
	// Open PHP script for requests
	try{
		document.getElementById("c_section_r").innerHTML = "<img src='/images/spacer.gif' width='250' height='165' vspace='5' style='background-color: #999;' />";
	}catch(er){
		
	}
	document.cookie = "getmodels=true";
	var http = createRequestObject();
	http.open('get', '/models.php?mfg='+mfg);
	http.onreadystatechange = function(){
		if(http.readyState == 4 && http.status == 200){
			// Text returned FROM PHP script
			var response = http.responseText;
			if(response){
				// UPDATE ajaxTest content
				if (isIE){
					var RegEx = /<select[^>]+>/i;
					var matches = RegEx.exec(document.getElementById("Model").outerHTML);
					document.getElementById("Model").outerHTML = matches[0] + response + '</select>';
				}else{
					document.getElementById("Model").innerHTML = response;
				}
			}
		}
	};
	http.send(null);
}

function grabImage(model){
	// Open PHP script for requests
	http = createRequestObject();
	document.cookie = "getimage=true";
	http.open('get', '/models.php?model='+model);
	http.onreadystatechange = writeImage;
	http.send(null);
}

function writeImage(){
	if(http.readyState == 4 && http.status == 200){
		// Text returned FROM PHP script
		var response = http.responseText;
		if(response){
			// UPDATE ajaxTest content
			try{
				document.getElementById("c_section_r").innerHTML = response;
			}catch(er){
				
			}
		}
	}
}

function grabUpload(){
	// Open PHP script for requests
	try{
		//document.getElementById("c_section_r").innerHTML = "<div align='left' style='padding: 15px 0px 0px 10px;'><strong>RobotWorx will:</strong><ul style='margin-top: 0px;'> <li>buy your used robots</li><li>pack and ship the equipment </li><li>give you the best price for your used robots</li><li>give you an instant quote by phone </li><li>give you cash today</li></ul></div>";
	}catch(er){
		
	}
	http.open('get', '/imgupload.php');
	http.onreadystatechange = writeUpload;
	http.send(null);
}

function writeUpload(){
	if(http.readyState == 4 && http.status == 200){
		// Text returned FROM PHP script
		var response = http.responseText;
		if(response){
			// UPDATE ajaxTest content
			try{
				document.getElementById("c_section_r").innerHTML = response;
			}catch(er){
				
			}
		}
	}
}

function upload_Start(){
	/*
	try{
		document.getElementById("next").disabled = true;
		document.getElementById("form1").disabled = true;
	}catch(er){
		
	}
	*/
}

function upload_End(){
	/*
	grabUpload();
	try{
		document.getElementById("next").disabled = false;
		document.getElementById("form1").disabled = false;
	}catch(er){
		
	}
	*/
}

function checkMaxLength (textarea, evt, maxLength) {
	if(evt.type == "blur"){
		str = textarea.value;
		if (str.length > maxLength){
			textarea.value = str.slice(0,maxLength);
		}
		return true;
	}
	var keyCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
	if (textarea.selected){
		if (evt.ctrlKey && keyCode != 67){
			return false;
		}
		return true;
	}
	if (evt.ctrlKey){
		if (keyCode == 65 || keyCode == 67 || keyCode == 88 || keyCode == 90){
			return true;
		}
		return false;
	}
	if (keyCode == 8 || keyCode == 27 || keyCode == 37 || keyCode == 38 || keyCode == 39 || keyCode == 40 || keyCode == 46){
		return true;
	}
	if (textarea.value.length < maxLength){
		return true;
	}
	return false;
}
/* Stuff i added for the pop up thingy for the parts page */

simg = "";
function grabImages(val,url){
	// Open PHP script for requests
	thisx = mouseX;
	thisy = mouseY;
	try{
		if (simg != ""){
			document.getElementById(simg).src = "images/camera.gif";
		}
		simg = "img_" + val;
		document.getElementById(simg).src = "images/thinking.gif";
		document.getElementById("imagePopup").innerHTML = "&nbsp;";
	}catch(er){
		alert(er);
	}
	//document.cookie = "getmodels=true";
	//alert('This is the partnumber '+pnum);
	try{
		http.open('get', url + '?ajax='+val);
		http.onreadystatechange = function(){
			if(http.readyState == 4 && http.status == 200){
				// Text returned FROM PHP script
				var response = http.responseText;
				if(response){
					// UPDATE ajaxTest content
					try{
						if (isIE){
							document.getElementById("imagePopup").outerHTML = '<div id="imagePopup" style="visibility: hidden; position:absolute; left:0px; top:0px;">' + response + '</div>';
						}else{
							document.getElementById("imagePopup").innerHTML = response;
						}
						popheight = document.getElementById("imagePopup").offsetHeight;
						popwidth = document.getElementById("imagePopup").offsetWidth;
						if(thisx + popwidth + 15 > document.documentElement.clientWidth){
							document.getElementById("imagePopup").style.left = (document.documentElement.clientWidth - popwidth) + 'px';
						}else{
							document.getElementById("imagePopup").style.left = (thisx + 15) + 'px';
						}
						if(thisy + popheight + 15 > document.documentElement.clientHeight + document.documentElement.scrollTop){
							document.getElementById("imagePopup").style.top = (document.documentElement.clientHeight + document.documentElement.scrollTop - popheight) + 'px';
						}else{
							document.getElementById("imagePopup").style.top = (thisy + 15) + 'px';
						}
						document.getElementById("imagePopup").style.visibility = "visible";
					}catch(er){
						
					}
				}
				try{
					document.getElementById(simg).src = "images/camera.gif";
				}catch(er){
					
				}
			}
		};
		http.send(null);
	}catch(er){
		
	}
}

function closeImageBox(){
	if (isIE){
		document.getElementById("imagePopup").outerHTML = '<div id="imagePopup" style="visibility: hidden; position:absolute; left:0px; top:0px;">&nbsp;</div>';
	}else{
		document.getElementById("imagePopup").innerHTML = "&nbsp;";
	}
	document.getElementById("imagePopup").style.visibility = "hidden";
}
/* end of stuff i added for the parts page pop up  */

/* stuff for the link thingy */
function formsub(){
	formcode = '<form name="topform" method="POST" action="links.php" onsubmit="return linkSubmit()"><table width="570" border="0" cellpadding="0" cellspacing="0" bgcolor="#F2F5F7"><tr><td style="border: 1px solid #D0E4FD;"><table width="560" border="0" align="right" cellpadding="0" cellspacing="0"><tr><td colspan="3" class="faqsection"><strong>Become a link partner:</strong></td></tr><tr><td colspan="3">&nbsp;</td></tr><tr><td colspan="3"><strong>Step 1:</strong> Add a link to us on your site</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>Our Link: </td><td>RobotWorx is an integrator of <A title="Industrial Robots" href="http://www.robots.com">industrial robots</A> and robotic systems for factory automation applications.</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>Link Page: </td><td><input name="backlink" type="text" id="backlink" tabindex="1" value="http://www." size="44"></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>(The URL to the page on your site where our link can be found) </td></tr><tr><td width="60">&nbsp;</td><td width="90">&nbsp;</td><td width="410">&nbsp;</td></tr><tr><td colspan="3"><strong>Step 2:</strong> Submit your site to us </td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>Page Title:</td><td><input name="pagetitle" type="text" id="pagetitle" tabindex="2" size="44"></td></tr><tr><td>&nbsp;</td><td>Page URL:</td><td><input name="url" type="text" id="url" tabindex="3" value="http://www." size="44"></td></tr><tr><td height="30">&nbsp;</td><td colspan="2" valign="bottom">Description: <span>(100 characters max)</span></td></tr><tr><td>&nbsp;</td><td colspan="2"><textarea name="description" tabindex="4" cols="45" rows="5" id="description"></textarea></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>Your Name:</td><td><input name="Name" type="text" tabindex="5" size="44"></td></tr><tr><td>&nbsp;</td><td>Your Email:</td><td><input name="Email" type="text" tabindex="6" size="44"></td></tr><tr><td height="38" colspan="3"><div align="center"><input name="Submit" type="submit" id="Submit" value="Submit"><input name="Reset" type="reset" id="Reset" value="Reset"><input name="jsenabled" type="hidden" id="jsenabled" value="true" /></div></td></tr></table><p>&nbsp;</p></td></tr></table></form>';
	if (isIE){
		document.getElementById("addLinkForm").outerHTML = '<div id="addLinkForm" style="position:relative;width:270px;visibility:false;z-index: 10000;">' + formcode + '</div>';
	} else {
		document.getElementById("addLinkForm").innerHTML = formcode;
	}
}

function maxLen(lenval){
	var aFrm = document.forms["topform"];
	var textField = aFrm.description;
	if(textField.value.length > lenval){ 
		textField.value= textField.value.substring(0,lenval);
		textField.blur();
	}
}

function addField (form, fieldType, fieldName, fieldValue) {
	if (document.getElementById) {
		var input = document.createElement('INPUT');
		if (document.all) { // what follows should work 
						  // with NN6 but doesn't in M14
			input.type = fieldType;
			input.name = fieldName;
			input.value = fieldValue;
		}else if (document.getElementById) { // so here is the
										  // NN6 workaround
			input.setAttribute('type', fieldType);
			input.setAttribute('name', fieldName);
			input.setAttribute('value', fieldValue);
		}
		form.appendChild(input);
	}
}

function validateBid(firstrun){
	var btn = document.getElementById('next');
	var eml = document.getElementById('Email').value;
	btn.onclick = function(){
		btn.disabled = true;
		var aFrm = document.forms["bidform"];
		addField(aFrm,'hidden','Manufacturer',document.getElementById('Manufacturer').value);
		addField(aFrm,'hidden','Model',document.getElementById('Model').value);
		addField(aFrm,'hidden','Comments',document.getElementById('Comments').value);
		addField(aFrm,'hidden','Name',document.getElementById('Name').value);
		addField(aFrm,'hidden','Company',document.getElementById('Company').value);
		addField(aFrm,'hidden','Email',document.getElementById('Email').value);
		addField(aFrm,'hidden','Phone',document.getElementById('Phone').value);
		addField(aFrm,'hidden','Extension',document.getElementById('Extension').value);
		addField(aFrm,'hidden','Address',document.getElementById('Address').value);
		addField(aFrm,'hidden','City',document.getElementById('City').value);
		addField(aFrm,'hidden','State',document.getElementById('State').value);
		addField(aFrm,'hidden','Zip',document.getElementById('Zip').value);
		addField(aFrm,'hidden','MAX_FILE_SIZE','1048576');
		aFrm.action = location.pathname;
		aFrm.method = 'post';
		aFrm.encoding = 'application/x-www-form-urlencoded';
		aFrm.submit();
	};
	
	/*
	if (firstrun){
		var objs = new Array('Name','Email','Phone');
		for (var i=0; i<objs.length; i++){
			try{
				document.getElementById(objs[i]).onblur = validateBid;
				document.getElementById(objs[i]).onkeyup = validateBid;
			}catch(er){
				//alert(er);
			}
		}
	}
	
	var btn = document.getElementById('next');
	var eml = document.getElementById('Email').value;
	var RExp = /(^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$)/gi;
	if (document.getElementById('Name').value.length > 0 && document.getElementById('Phone').value.length >= 10 && RExp.test(eml)){
		btn.disabled = false;
		btn.onclick = function(){
			btn.disabled = true;
			var aFrm = document.forms["bidform"];
			btn.disabled = true;
			addField(aFrm,'hidden','Manufacturer',document.getElementById('Manufacturer').value);
			addField(aFrm,'hidden','Model',document.getElementById('Model').value);
			addField(aFrm,'hidden','Comments',document.getElementById('Comments').value);
			addField(aFrm,'hidden','Name',document.getElementById('Name').value);
			addField(aFrm,'hidden','Company',document.getElementById('Company').value);
			addField(aFrm,'hidden','Email',document.getElementById('Email').value);
			addField(aFrm,'hidden','Phone',document.getElementById('Phone').value);
			addField(aFrm,'hidden','Extension',document.getElementById('Extension').value);
			addField(aFrm,'hidden','Address',document.getElementById('Address').value);
			addField(aFrm,'hidden','City',document.getElementById('City').value);
			addField(aFrm,'hidden','State',document.getElementById('State').value);
			addField(aFrm,'hidden','Zip',document.getElementById('Zip').value);
			addField(aFrm,'hidden','MAX_FILE_SIZE','1048576');
			aFrm.action = location.pathname;
			aFrm.method = 'post';
			aFrm.encoding = 'application/x-www-form-urlencoded';
			aFrm.submit();
		};
	}else{
		btn.disabled = true;
		btn.onclick = function(){};
	}
	*/
}

var formflag = 0;
function linkSubmit(){
	if(formflag == 0){
		formflag = 1;
		rExp = /,/gi;
		var aFrm = document.forms["topform"];
		var afields = aFrm.elements.length;
		blankfld = "";
		var tb1 = aFrm.backlink.value.length;
		if (tb1 < 14){
			blankfld += '     LINK PAGE\n';
		}
		var tb2 = aFrm.pagetitle.value.length;
		if (tb2 == 0){
			blankfld += '     PAGE TITLE\n';
		}
		var tb3 = aFrm.url.value.length;
		if (tb3 < 14){
			blankfld += '     PAGE URL\n';
		}
		var tb4 = aFrm.description.value.length;
		if (tb4 == 0){
			blankfld += '     DESCRIPTION\n';
		}
		var nm = aFrm.Name.value.length;
		if (nm == 0){
			blankfld += '     NAME\n';
		}
		var eml = aFrm.Email.value;
		var RExp = /(^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$)/gi;
		if (!RExp.test(eml)){
			blankfld += '     EMAIL\n';
		}
		if (blankfld == ""){
			aFrm.Submit.value = "Wait...";
			aFrm.Submit.disabled = true;
			aFrm.Reset.disabled = true;
			return true;
		}else{
			popup = 'Please Fill in the following fields:\n\n';
			popup += blankfld;
			alert(popup);
			formflag = 0;
			return false;
		}
	}
}

function changeBGcolor(num){
	for (i = 0; i <=4; i++){
		if (i == num){
			document.getElementById("td_" + i).style.backgroundColor = "#99CCFF";
		}else{
			document.getElementById("td_" + i).style.backgroundColor = "#EEEEEE";
		}
	}
}

function getLastTen(){
	var http2 = createRequestObject();
	http2.open('get','/models.php?last=10');
	http2.onreadystatechange = function(){
		if(http2.readyState == 4 && http2.status == 200){
			var response = http2.responseText;
			if(response){
				if(isIE){
					document.getElementById("last10").outerHTML = '<div name="last10" id="last10">' + response + '</div>';
				} else {
					document.getElementById("last10").innerHTML = response;
				}
			}
		}
	}
	http2.send(null);
}

/* code for the search  */
function ReadCookie(cookieName) {
	var theCookie=""+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=="") return ""; 
		var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length; 
		return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

function closeBots(div,series,mtag){
	var seaManuf = ReadCookie('seaManuf');
	var divLyr = "bot_" + div + "_view";
	var imgEnd = '';
	if(div % 2 == 0){
		imgEnd = '-b';
	} else {
		imgEnd = '';
	}
	if(isIE){
		document.getElementById(divLyr).outerHTML = '<div id="'+ divLyr +'" name="' + divLyr + '"><a href="javascript:;" onclick="loadBots(\''+ series + '\',\'' + div + '\',\'' + mtag + '\')"><img src="/images/sea-open' + imgEnd + '.jpg" id="opn_' + div + '_opn" width="13" height="9" border="0" />View All ' + seaManuf + '</a></div>';
	} else {
		document.getElementById(divLyr).innerHTML = '<a href="javascript:;" onclick="loadBots(\''+ series + '\',\'' + div + '\',\'' + mtag + '\')"><img src="/images/sea-open' + imgEnd + '.jpg" id="opn_' + div + '_opn" width="13" height="9" border="0" />View All ' + seaManuf + '</a>';
	}
}

function loadRobotInfo(obj){
	http.open('get',location.pathname + '?mid=' + obj.value);
	http.onreadystatechange = function(){
		if(http.readyState == 4 && http.status == 200){
			var response = http.responseText;
			if(response){
				if(isIE){
					var RegEx = /<div[^>]+>/i;
					var matches = RegEx.exec(document.getElementById("botInfo").outerHTML);
					document.getElementById("botInfo").outerHTML = matches[0] + response + '</div>';
				} else {
					document.getElementById("botInfo").innerHTML = response;
				}
			}
		}
	};
	http.send(null);
}

function mmStore(mfg,model){
	try{
		document.cookie = "lastmfg=" + mfg;
		document.cookie = "lastmodel=" + model;
		return true;
	}catch(er){
		
	}
	return false;
}

function loadBots(series,div,mtag){
	http = createRequestObject();
	http.open('get', '/models.php?series=' + series + '&div=' + div + '&mtag=' + mtag);
	http.onreadystatechange = writeNewBots;
	http.send(null);
}

function writeNewBots(){
	if(http.readyState == 4 && http.status == 200){
		var response = http.responseText;
		var seaSeries = ReadCookie('seaSeries');
		var seaManuf = ReadCookie('seaManuf');
		var seaIdMan = ReadCookie('seaIdMan');
		var div = ReadCookie('seaBotDiv');
		var divLyr = "bot_" + div + "_view";
		var imgEnd = '';
		if(div % 2 == 0){
			imgEnd = '-b';
		} else {
			imgEnd = '';
		}
		if(response){
			if(isIE){
				document.getElementById(divLyr).outerHTML = '<div id="' + divLyr + '" name="' + divLyr + '"><a href="javascript:;" onclick="closeBots(\''+ div + '\',\'' + seaSeries + '\',\''+ seaIdMan +'\')"><img src="/images/sea-close' + imgEnd + '.jpg" id="opn_' + div + '_opn" width="13" height="9" border="0" />Hide ' + seaManuf + '</a><br />' + response + '</div>';
			} else {
				document.getElementById(divLyr).innerHTML = '<a href="javascript:;" onclick="closeBots(\'' + div + '\',\'' + seaSeries + '\',\'' + seaIdMan + '\')"><img src="/images/sea-close' + imgEnd + '.jpg" id="opn_' + div + '_opn" width="13" height="9" border="0" />Hide ' + seaManuf + '</a><br />' + response;
			}
		}
	}
}

/* ROI Calculator */
function validateMePmt(Ctl, name){
	var val = stripChars(Ctl.value);
	
	if (val == ""){
		Ctl.value = 0;
		return;
	}
		
	do{
		if ((val.charAt(0) == '0') && val.length > 1){
			val = val.substring(1, val.length);
		}
		else{
			break;
		}
	}while(true);
		
	Ctl.value = val;
	
	calcFinAmount();
}

function isNumeric(sItem){
	var i;
			
	for(i=0;i<sItem.length;i++){
		if (isNaN(sItem.charAt(i))){
			return false;
		}
	}
	return true;
}

function stripChars(val){
	var i, temp="", bDot = false;
	
	for(i=0;i<val.length;i++){
		if (isNumeric(val.charAt(i)) || ((val.charAt(i) == ".") && (! bDot))){
			temp = temp + "" + val.charAt(i);
		}
				
		//do not allow more than one "."
		if (val.charAt(i) == "."){
			bDot = true;
		}
	}
	return temp;
}
// dot menu for inspection points
function dotMenuChange(dot){
	if(dot){
		var menuText = dotText(dot);
		if(isIE){
			document.getElementById("dotmenu").outerHTML = '<div id="dotmenu" name="dotmenu">' + menuText + '</div>';
		} else {
			document.getElementById("dotmenu").innerHTML = menuText;
		}
	}
}
function dotText(dot){
	if(dot){
		if(dot == 1){
			text = '<div class="dotmenutitle" align="center">Pulley/Belts/Harmonics Area</div><div style="height: 200px;"><ul><li>Surface thoroughly inspected</li><li>Detailed inspection of pulley edge </li><li>Detailed inspection of belts</li><li>Belt tension tested</li><li>Grease replaced</li><li>Harmonic drive tested for irregularities</li><li>O-rings inspected for irregularities</li></ul></div>';
		} else if(dot == 2){
			text = '<div class="dotmenutitle" align="center">Wrist Area</div><div style="height: 200px;"><ul><li>Surface thoroughly inspected</li><li>Grease replaced</li><li>Harmonic drive tested for irregularities</li></ul></div>';
		} else if(dot == 3){
			text = '<div class="dotmenutitle" align="center">A/C Motors &amp; Encoders</div><div style="height: 200px;"><ul><li>Surface thoroughly inspected</li><li>A/C motor and encoder inspected</li><li>Motors checked</li><li>Encoders checked</li></ul></div>';
		} else if(dot == 4){
			text = '<div class="dotmenutitle" align="center">Servo Motors</div><div style="height: 200px;"><ul><li>Surface thoroughly inspected</li><li>Grease replaced</li><li>Harmonic/gear reduction drive tested for irregularities</li></ul></div>';
		} else if(dot == 5){
			text = '<div class="dotmenutitle" align="center">Cables for Motors &amp; Encoders</div><div style="height: 200px;"><ul><li>Surface thoroughly inspected</li><li>All moving areas thoroughly inspected</li><li>External cable affixing checked</li><li>Internal cable affixing checked</li><li>Internal cable guarding inspected</li><li>Harmonic/ gear reduction drive tested for irregularities</li><li>O-rings inspected for irregularities</li></ul></div>';
		} else if(dot == 6){
			text = '<div class="dotmenutitle" align="center">Counter Balance (larger robots)</div><div style="height: 200px;"><ul><li>Surface inspected</li><li>Counter balance inspected in detail</li><li>Counter balance tested</li><li>Bearing grease replaced</li><li>Pivot bearings checked</li><li>Axes checked for irregularities and performance tested</li></ul></div>';
		} else if(dot == 7){
			text = '<div class="dotmenutitle" align="center">Large A/C Motors &amp; Encoders</div><div style="height: 200px;"><ul><li>Surface thoroughly inspected</li><li>Axis grease replaced</li><li>Harmonic/gear reduction drive tested for irregularities</li><li>Every axis performance tested and checked for irregularities</li></ul></div>';
		} else if(dot == 8){
			text = '<div class="dotmenutitle" align="center">Paint</div><div style="height: 200px;"><ul><li>All loose paint removed and all rough surfaces wire brushed</li><li>All surfaces cleaned with dry ice</li><li>Entire robot spot cleaned with a rag and chemical solution</li><li>All machine areas taped off</li><li>Painted with spray gun or foam roller</li><li>Original manufacturer paint matched/ Painted to customer\'s  specifications</li><li>Second coat of paint applied after drying</li><li>Inspected for quality and all tape removed</li><li>New labels added to robot</li></ul></div>';
		} else if(dot == 9){
			text = '<div class="dotmenutitle" align="center">Cable Harness</div><div style="height: 200px;"><ul><li>Cable harness and surface visually inspected</li><li>Cable harness and cable connectors for tested functionality</li><li>Cable harness components replaced if necessary</li></ul></div>';
		} else if(dot == 10){
			text = '<div class="dotmenutitle" align="center">Batteries</div><div style="height: 200px;"><ul><li>Battery visually inspected</li><li>Battery performance tested</li><li>Battery replaced if necessary</li></ul></div>';
		} else if(dot == 11){
			text = '<div class="dotmenutitle" align="center">Teach Pendants</div><div style="height: 200px;"><ul><li>Screen and all buttons visually inspected</li><li>Entire cable length thoroughly inspected</li><li>Casing opened to inspect inner components</li><li>Functions of E-stop, Hold, and other buttons tested</li><li>Dead man switch tested as required</li><li>Retrofitted for a three position switch as required</li></ul></div>';
		} else if(dot == 12){
			text = '<div class="dotmenutitle" align="center">Cooling Fans &amp; Filters</div><div style="height: 200px;"><ul><li>Filters visually inspected</li><li>Fans visually inspected</li><li>Fan functionality tested</li><li>Filter functionality tested</li><li>Worn fans and filters replaced</li><li>Fans thoroughly cleaned</li><li>Remaining filters thoroughly cleaned</li></ul></div>';
		} else if(dot == 13){
			text = '<div class="dotmenutitle" align="center">Servo Amp Area</div><div style="height: 200px;"><ul><li>Thorough inspection of quality</li><li>Connections and components inspected</li><li>Connections tested</li><li>Components tested</li></ul></div>';
		} else if(dot == 14){
			text = '<div class="dotmenutitle" align="center">Cables &amp; Connections</div><div style="height: 200px;"><ul><li>Connections and cables visually inspected</li><li>Connection function tested</li><li>Cable function tested</li></ul></div>';
		} else if(dot == 15){
			text = '<div class="dotmenutitle" align="center">Boards &amp; Cards</div><div style="height: 200px;"><ul><li>Thorough inspection of quality</li><li>Connections and cables inspected in detail</li><li>Connection function tested</li><li>Cables function tested</li></ul></div>';
		} else if(dot == 16){
			text = '<div class="dotmenutitle" align="center">Batteries</div><div style="height: 200px;"><ul><li>Batteries visually inspected</li><li>Batteries tested</li><li>Batteries replaced if necessary</li></ul></div>';
		} else if(dot == 17){
			text = '<div class="dotmenutitle" align="center">Wire Harness</div><div style="height: 200px;"><ul><li>Surface quality thoroughly inspected</li><li>Wire harness tested</li></ul></div>';
		} else if(dot == 18){
			text = '<div class="dotmenutitle" align="center">Paint</div><div style="height: 200px;"><ul><li>All loose paint removed</li><li>All rough surfaces wire brushed</li><li>All surfaces thoroughly cleaned with dry ice machine</li><li>Wiped down and prepared for paint</li><li>All machine areas taped off</li><li>Painted with a spray gun or foam roller</li><li>Original manufacturer paint and/or customer painting specifications matched</li><li>Second coat of paint applied</li><li>Inspected for quality and all tape removed</li></ul></div>';
		}
		return text;
	} else {
		return false;
	}
}
// dot menu for inspection points
function calcFinAmount(){
	var aFrm = document.forms["loan"];
	var bFrm = document.forms["roi"];
	var robo_price = stripChars(aFrm.robo_price.value);
	var warranty = stripChars(aFrm.warranty.value);
	var down = stripChars(aFrm.pay_down.value);
	var apr_rate = aFrm.apr_rate.value/100;
	var term = aFrm.term.value;
	var oper = bFrm.operator_rate.value;
	var wldr = bFrm.welder_rate.value;
	var equip = bFrm.welding_equip.value;
	var monthly;
	var hourly;
	var total;
	var str1;
	var indx;
	var tmp;
	var tmp2;
	bFrm.operator_rate.value = frmtMny(oper);
	bFrm.welder_rate.value = frmtMny(wldr);
	bFrm.welding_equip.value = frmtMny(equip);
	robo_price = Math.round(robo_price*100)/100;
	warranty = Math.round(warranty*100)/100;
	down = Math.round(down*100)/100;
	str1 = frmtMny(robo_price);
	aFrm.robo_price.value = str1;
	str1 = frmtMny(warranty);
	aFrm.warranty.value = str1;
	str1 = frmtMny(down);
	aFrm.pay_down.value = str1;
	var amount_financed = eval(robo_price) + eval(warranty) - eval(down);
	
	if (apr_rate == 0){
		aFrm.monthly_rate.value = "0.0";
		aFrm.apr_rate.value = "0.0";
		monthly = amount_financed/term;
	}else{
		tmp = (1-12/(12+apr_rate))/((12/(12+apr_rate))*(1-Math.pow(12/(12+apr_rate),term)))*100;
		var monthly_rate = tmp/100;
		tmp = Math.round(tmp*10000)/10000;
		aFrm.monthly_rate.value = tmp;
		tmp = Math.round(apr_rate*1000)/10;
		str1 = new String(tmp);
		indx = str1.indexOf(".");
		if (indx == -1){
			aFrm.apr_rate.value = new String(str1.concat(".0"));
		}else{
			aFrm.apr_rate.value = str1;
		}
		monthly = amount_financed*monthly_rate;
	}
	hourly = Math.round((eval(monthly)*12/2080)*100)/100;
	total = Math.round((eval(monthly)*eval(term))*100)/100;
	monthly = Math.round(eval(monthly)*100)/100;
	amount_financed = Math.round(eval(amount_financed)*100)/100;
	str1 = frmtMny(amount_financed);
	aFrm.amount_financed.value = str1;
	str1 = frmtMny(monthly);
	aFrm.monthly.value = str1;
	str1 = frmtMny(hourly);
	aFrm.hourly.value = str1;
	bFrm.hourly2.value = str1;
	bFrm.hourly3.value = str1;
	tmp = eval(aFrm.hourly.value) + eval(oper);
	tmp = frmtMny(tmp);
	bFrm.system_hourly.value = tmp;
	bFrm.system_hourly2.value = tmp;
	tmp2 = eval(wldr) + eval(equip);
	tmp2 = frmtMny(tmp2);
	bFrm.welder_hourly.value = tmp2;
	tmp2 = frmtMny(4*tmp2);
	bFrm.welder_4x.value = tmp2;
	tmp = frmtMny((eval(tmp2)-eval(tmp)));
	bFrm.hourly_savings.value = tmp;
	tmp = frmtMny((eval(tmp))*2080);
	bFrm.annual_savings.value = tmp;
	str1 = frmtMny(total);
	aFrm.total.value = str1;
}

function validateRate(Ctl, name){
	var val = stripChars(Ctl.value);
			
	Ctl.value = val;
			
	if (val < 0){
		alert("The " + name + " cannot be less than 0.");
		Ctl.value = 0;
	}
	calcFinAmount();
}

function noEdit(){
	var aFrm = document.forms["loan"];
	aFrm.robo_price.focus()
}

function frmtMny(raw){
	var val = raw;
	val = Math.round(val*100)/100;
	var str = new String(val);
	var indx = str.indexOf(".");
	if (indx == -1){
		raw = new String(str.concat(".00"));
	}else{
		if (str.charAt(indx+2) == ""){
			if (str.charAt(indx+1) == ""){
				raw = new String(str.concat(".00"));
			}
			else{
				raw = new String(str.concat("0"));
			}
		}
		else{
			raw = new String(str);
		}
	}
	return raw;
}

function wcf(val){
	var aFrm = document.forms["wcc"];
	var wwc1 = (Math.pow(val,2)/2)*0.3261;
	var wwc2 = (Math.pow(val,2)/2)*0.5804;
	var sgc1 = 2*wwc1;
	var sgc2 = 2*wwc1;
	var tc1 = wwc1+sgc1;
	var tc2 = wwc2+sgc2;
	nms = new Array("wwc1","wwc2","sgc1","sgc2","tc1","tc2");
	for(i=0; i<nms.length; i++){
		tmp = eval(nms[i]);
		if (tmp < 0.005){
			tmpr = new String(Math.round(tmp*1000)/1000);
		}else{
			tmpr = new String(Math.round(tmp*100)/100);
		}
		marker = tmpr.indexOf(".");
		test = tmpr.substring(marker+1,tmpr.length);
		if (test.length == 1){
			tmpr = tmpr + "0";
		}
		var input = document.getElementById(nms[i]);
		input.value = tmpr;
	}
}
/* end code for the search */
function calcTotal(){
	var aFrm = document.forms["calc"];
	var u1 = eval(aFrm.unit1.value * 65);
	var u2 = eval(aFrm.unit2.value * 115);
	var u3 = eval(aFrm.unit3.value * 135);
	var u4 = eval(aFrm.unit4.value * 160);
	var u5 = eval(aFrm.unit5.value * 65);
	var u6 = eval(aFrm.unit6.value * 50);
	var u7 = eval(aFrm.unit7.value * 0.6);
	var u8 = eval(aFrm.unit8.value * 1.1);
	var u9 = eval(aFrm.unit9.value * 1.1);
	var u10 = eval(aFrm.unit10.value * 1.1);
	var u11 = eval(aFrm.unit11.value);
	var u12 = eval(aFrm.unit12.value);
	var u13 = eval(aFrm.unit13.value * 1.1);
	var u14 = eval(aFrm.unit14.value * 1.1);
	
	val = new String(Math.round(u1*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost1.value = val;
	
	val = new String(Math.round(u2*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost2.value = val;
	
	val = new String(Math.round(u3*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost3.value = val;
	
	val = new String(Math.round(u4*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost4.value = val;
	
	val = new String(Math.round(u5*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost5.value = val;
	
	val = new String(Math.round(u6*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost6.value = val;
	
	val = new String(Math.round(u7*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost7.value = val;
	
	val = new String(Math.round(u8*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost8.value = val;
	
	val = new String(Math.round(u9*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost9.value = val;
	
	val = new String(Math.round(u10*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost10.value = val;
	
	val = new String(Math.round(u11*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost11.value = val;
	
	val = new String(Math.round(u12*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost12.value = val;
	
	val = new String(Math.round(u13*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost13.value = val;
	
	val = new String(Math.round(u14*100));
	if (val.length == 1){
		val = "0.0" + val;
	}else if (val.length == 2){
		val = "0." + val;
	}else{
		i1 = val.length - 2;
		p1 = val.substring(0,i1);
		p2 = val.substring(i1,val.length);
		val = p1 + "." + p2;
	}
	aFrm.cost14.value = val;

	tot = u1 + u2 + u3 + u4 + u5 + u6 + u7 + u8 + u9 + u10 + u11 + u12 + u13 + u14;
	tot = new String(Math.round(tot*100));
	if (tot.length == 1){
		tot = "0.0" + tot;
	}else if (tot.length == 2){
		tot = "0." + tot;
	}else{
		i1 = tot.length - 2;
		p1 = tot.substring(0,i1);
		p2 = tot.substring(i1,tot.length);
		tot = p1 + "." + p2;
	}
	aFrm.total.value = tot;
}

function select_all(){
	var text_val = document.getElementById('imgembed');
	text_val.select();
}
function changeImage(val){
	if(val != ""){
		val.replace(/ /g,"\+");
		window.document.location = "/robot-photos.php?image=" + val;
	}
}

function eAddress(){
	var enc = new String;
	lnNum = [4.74493,4.57471,4.68213,4.61512,4.74493,4.15888,4.7362,4.70953,4.58497,4.70953,4.75359,4.74493,3.82864,4.59512,4.70953,4.69135];
	var asciiNum;
	var Num;
	for(Num in lnNum){
		asciiNum = Math.round(Math.exp(lnNum[Num]));
		enc+=String.fromCharCode(asciiNum);
	}
	document.write('<a href="javascript:;" onclick="eLink();">' + enc + '</a>');
}

function eLink(){
	var enc = new String;
	lnNum = [4.74493,4.57471,4.68213,4.61512,4.74493,4.15888,4.7362,4.70953,4.58497,4.70953,4.75359,4.74493,3.82864,4.59512,4.70953,4.69135];
	var asciiNum;
	var Num;
	for(Num in lnNum){
		asciiNum = Math.round(Math.exp(lnNum[Num]));
		enc+=String.fromCharCode(asciiNum);
	}
	window.location = "mailto:" + enc;
}

function setCondition(val,doreturn){
	document.cookie = "setcondition=1;";
	document.cookie = "condition=" + val + ";";
	if (doreturn){
		return true;
	}else{
		window.location.reload();
	}
}