
function resetOrder()
{
	updateObj('xmlsmsInfo1', "Подождите пожалуйста!");	
	updateObj('xmlsmsText', "");
	updateObj('xmlsmsInfo2', "");	
	updateObj('xmlsmsShortPhone', "");
}

function updateObj(obj, data){ 
   document.getElementById(obj).innerHTML = data; 
}

function formSubmit() 
{
	function getVariant(theGroup) 
	{
	 for (i=0; i <= theGroup.length; i++)
		 if (theGroup[i].checked) 
		 {
			return theGroup[i].value;
			break;
		 }
	}
	function ajaxRead(file){ 
	  var xmlObj; 
	  if(window.XMLHttpRequest){ 
		  xmlObj = new XMLHttpRequest(); 
	  } else if(window.ActiveXObject){ 
		  xmlObj = new ActiveXObject("Microsoft.XMLHTTP");  
	  } else { 
		  return; 
	  } 
	  xmlObj.onreadystatechange = function(){ 
		if(xmlObj.readyState == 4){ 
			if (xmlObj.responseXML.getElementsByTagName('error')[0].firstChild.data.length > 2)
			{
			   updateObj('xmlsmsInfo1', xmlObj.responseXML.getElementsByTagName('error')[0].firstChild.data);	
			   updateObj('xmlsmsText', "");
			   updateObj('xmlsmsInfo2', "");	
			   updateObj('xmlsmsShortPhone', "");
			}
			else
			{
			   updateObj('xmlsmsInfo1', xmlObj.responseXML.getElementsByTagName('smsInfo')[0].firstChild.data);	
			   updateObj('xmlsmsText', xmlObj.responseXML.getElementsByTagName('smsText')[0].firstChild.data);
			   updateObj('xmlsmsInfo2', "на номер");	
			   updateObj('xmlsmsShortPhone', xmlObj.responseXML.getElementsByTagName('smsShortPhone')[0].firstChild.data);
			}
		 } 
		} 
		xmlObj.open ('GET', file, true); 
		xmlObj.send (''); 
	  } 
    url=GetOrderUrl();
	ajaxRead(url);
}

var x = 0;
//смещение по горизонтали
function getClientSLeft(){ return self.pageXOffset || (document.documentElement && document.documentElement.scrollLeft) || (document.body && document.body.scrollLeft); }

function scrollNext(destX) 
{
	x = destX;	
	if (getClientSLeft() < x)
	{
		window.scrollBy(10,0);
		setTimeout('scrollNext(x);', 10);
	}
	else
		window.scrollTo(x,0);
}

function scrollPrev(destX) 
{
	x = destX;
		
	if (getClientSLeft() > x)
	{
		window.scrollBy(-10,0);
		setTimeout('scrollPrev(x);', 10);
	}
	else
		window.scrollTo(x,0);
}

function init()
{
	oStringMask = new Mask("#(###)###-####");
	oStringMask.attach(document.audioForm.phone);
}
function _MaskAPI(){this.version="0.4b";this.instances=0;this.objects={}}MaskAPI=new _MaskAPI();function Mask(a,b){this.mask=a;this.type=(typeof b=="string")?b:"string";this.error=[];this.errorCodes=[];this.value="";this.strippedValue="";this.allowPartial=false;this.id=MaskAPI.instances++;this.ref="MaskAPI.objects['"+this.id+"']";MaskAPI.objects[this.id]=this}Mask.prototype.attach=function(a){$addEvent(a,"onkeydown","return "+this.ref+".isAllowKeyPress(event, this);",true);$addEvent(a,"onkeyup","return "+this.ref+".getKeyPress(event, this);",true);$addEvent(a,"onblur","this.value = "+this.ref+".format(this.value);",true)};Mask.prototype.isAllowKeyPress=function(b,c){if(this.type!="string"){return true}var a=new qEvent(b);if(((a.keyCode>47)&&(c.value.length>=this.mask.length))&&!a.ctrlKey){return false}return true};Mask.prototype.getKeyPress=function(f,h,c){this.allowPartial=true;var b=new qEvent(f);if((b.keyCode>47)||(c==true)||(b.keyCode==8||b.keyCode==46)){var a=h.value,g;if(b.keyCode==8||b.keyCode==46){g=true}else{g=false}if(this.type=="number"){this.value=this.setNumber(a,g)}else{if(this.type=="date"){this.value=this.setDateKeyPress(a,g)}else{this.value=this.setGeneric(a,g)}}h.value=this.value}this.allowPartial=false;return true};Mask.prototype.format=function(a){if(this.type=="number"){this.value=this.setNumber(a)}else{if(this.type=="date"){this.value=this.setDate(a)}else{this.value=this.setGeneric(a)}}return this.value};Mask.prototype.throwError=function(d,b,a){this.error[this.error.length]=b;this.errorCodes[this.errorCodes.length]=d;if(typeof a=="string"){return a}return true};Mask.prototype.setGeneric=function(q,l){var s=q,e=this.mask;var c="x#*",f=[],k="",u,p,o=[],g=0,d={x:"A-Za-z","#":"0-9","*":"A-Za-z0-9"};s=s.replace(new RegExp("[^"+d["*"]+"]","gi"),"");if((l==true)&&(s.length==this.strippedValue.length)){s=s.substring(0,s.length-1)}this.strippedValue=s;var n=[];for(var h=0;h<e.length;h++){p=e.charAt(h);u=(c.indexOf(p)>-1);if(p=="!"){p=e.charAt(h++)}if((u&&!this.allowPartial)||(u&&this.allowPartial&&(f.length<s.length))){f[f.length]="["+d[p]+"]"}o[o.length]={chr:p,mask:u}}var w=false;if(!this.allowPartial&&!(new RegExp(f.join(""))).test(s)){return this.throwError(1,'The value "'+q+'" must be in the format '+this.mask+".",q)}else{if((this.allowPartial&&(s.length>0))||!this.allowPartial){for(h=0;h<o.length;h++){if(o[h].mask){while(s.length>0&&!(new RegExp(f[g])).test(s.charAt(g))){s=(s.length==1)?"":s.substring(1)}if(s.length>0){k+=s.charAt(g);w=true}g++}else{k+=o[h].chr}if(this.allowPartial&&(g>s.length)){break}}}}if(this.allowPartial&&!w){k=""}if(this.allowPartial){if(k.length<o.length){this.nextValidChar=d[o[k.length].chr]}else{this.nextValidChar=null}}return k};function qEvent(b){if(window.Event){var a=(b.type.substring(0,3)=="key");this.keyCode=(a)?parseInt(b.which,10):0;this.button=(!a)?parseInt(b.which,10):0;this.srcElement=b.target;this.type=b.type;this.x=b.pageX;this.y=b.pageY;this.screenX=b.screenX;this.screenY=b.screenY;if(document.layers){this.altKey=((b.modifiers&Event.ALT_MASK)>0);this.ctrlKey=((b.modifiers&Event.CONTROL_MASK)>0);this.shiftKey=((b.modifiers&Event.SHIFT_MASK)>0);this.keyCode=this.translateKeyCode(this.keyCode)}else{this.altKey=b.altKey;this.ctrlKey=b.ctrlKey;this.shiftKey=b.shiftKey}}else{b=window.event;this.keyCode=parseInt(b.keyCode,10);this.button=b.button;this.srcElement=b.srcElement;this.type=b.type;if(document.all){this.x=b.clientX+document.body.scrollLeft;this.y=b.clientY+document.body.scrollTop}else{this.x=b.clientX;this.y=b.clientY}this.screenX=b.screenX;this.screenY=b.screenY;this.altKey=b.altKey;this.ctrlKey=b.ctrlKey;this.shiftKey=b.shiftKey}if(this.button==0){this.setKeyPressed(this.keyCode);this.keyChar=String.fromCharCode(this.keyCode)}}qEvent.prototype.translateKeyCode=function(b){var a={};if(!!document.layers){if(this.keyCode>96&&this.keyCode<123){return this.keyCode-32}a={96:192,126:192,33:49,64:50,35:51,36:52,37:53,94:54,38:55,42:56,40:57,41:48,92:220,124:220,125:221,93:221,91:219,123:219,39:222,34:222,47:191,63:191,46:190,62:190,44:188,60:188,45:189,95:189,43:187,61:187,59:186,58:186,"null":null}}return(!!a[b])?a[b]:b};qEvent.prototype.setKP=function(a,b){this.keyPressedCode=a;this.keyNonChar=(typeof b=="string");this.keyPressed=(this.keyNonChar)?b:String.fromCharCode(a);this.isNumeric=(parseInt(this.keyPressed,10)==this.keyPressed);this.isAlpha=((this.keyCode>64&&this.keyCode<91)&&!this.altKey&&!this.ctrlKey);return true};qEvent.prototype.setKeyPressed=function(c){var a=this.shiftKey;if(!a&&(c>64&&c<91)){return this.setKP(c+32)}if(c>95&&c<106){return this.setKP(c-48)}switch(c){case 49:case 51:case 52:case 53:if(a){c=c-16}break;case 50:if(a){c=64}break;case 54:if(a){c=94}break;case 55:if(a){c=38}break;case 56:if(a){c=42}break;case 57:if(a){c=40}break;case 48:if(a){c=41}break;case 192:if(a){c=126}else{c=96}break;case 189:if(a){c=95}else{c=45}break;case 187:if(a){c=43}else{c=61}break;case 220:if(a){c=124}else{c=92}break;case 221:if(a){c=125}else{c=93}break;case 219:if(a){c=123}else{c=91}break;case 222:if(a){c=34}else{c=39}break;case 186:if(a){c=58}else{c=59}break;case 191:if(a){c=63}else{c=47}break;case 190:if(a){c=62}else{c=46}break;case 188:if(a){c=60}else{c=44}break;case 106:case 57379:c=42;break;case 107:case 57380:c=43;break;case 109:case 57381:c=45;break;case 110:c=46;break;case 111:case 57378:c=47;break;case 8:return this.setKP(c,"[backspace]");case 9:return this.setKP(c,"[tab]");case 13:return this.setKP(c,"[enter]");case 16:case 57389:return this.setKP(c,"[shift]");case 17:case 57390:return this.setKP(c,"[ctrl]");case 18:case 57388:return this.setKP(c,"[alt]");case 19:case 57402:return this.setKP(c,"[break]");case 20:return this.setKP(c,"[capslock]");case 32:return this.setKP(c,"[space]");case 91:return this.setKP(c,"[windows]");case 93:return this.setKP(c,"[properties]");case 33:case 57371:return this.setKP(c*-1,"[pgup]");case 34:case 57372:return this.setKP(c*-1,"[pgdown]");case 35:case 57370:return this.setKP(c*-1,"[end]");case 36:case 57369:return this.setKP(c*-1,"[home]");case 37:case 57375:return this.setKP(c*-1,"[left]");case 38:case 57373:return this.setKP(c*-1,"[up]");case 39:case 57376:return this.setKP(c*-1,"[right]");case 40:case 57374:return this.setKP(c*-1,"[down]");case 45:case 57382:return this.setKP(c*-1,"[insert]");case 46:case 57383:return this.setKP(c*-1,"[delete]");case 144:case 57400:return this.setKP(c*-1,"[numlock]")}if(c>111&&c<124){return this.setKP(c*-1,"[f"+(c-111)+"]")}return this.setKP(c)};function $addEvent(i,f,j,g){var h=f.toLowerCase(),d=(typeof g=="boolean")?g:true,a=(i[h])?i[h].toString():"";a=a.substring(a.indexOf("{")+1,a.lastIndexOf("}"));a=((d)?(a+j):(j+a))+"\n";return i[h]=(!!window.Event)?new Function("event",a):new Function(a)};

