function modifyTable(showID) {
	var table = document.getElementById('listTable');
	var activePoint = document.getElementsByTagName('span');
	for (var pointID = 0; (point = activePoint[pointID]); pointID++) {
		if (point.className == 'sortListActive') point.className = 'sortList';
		if (point.id == showID) point.className = 'sortListActive';	
	}
	for (var trID = 1; (row = table.getElementsByTagName('tr')[trID]); trID++) {
		if (row.id.indexOf("-"+showID+"-")>-1) row.style.display = '';
		else row.style.display = 'none';
	}
}

function modifyDiv(showID) {
	var table = document.getElementById('listTable');
	var activePoint = document.getElementsByTagName('span');
	for (var pointID = 0; (point = activePoint[pointID]); pointID++) {
		if (point.className == 'sortListActive') point.className = 'sortList';
		if (point.id == showID) point.className = 'sortListActive';
	}
	for (var divID = 1; (oblock = table.getElementsByTagName('div')[divID]); divID++) {
		if (oblock.id.indexOf("-"+showID+"-")>-1) oblock.style.display = '';
		else oblock.style.display = 'none';
	}
}

function modifyTR(showID) {
	var table = document.getElementById('listTable');
	for (var trID = 1; (row = table.getElementsByTagName('tr')[trID]); trID++) {
		if (row.id.indexOf("-"+showID+"-")>-1) (row.style.display=='none') ? row.style.display = '' : row.style.display = 'none';

	}
}

function catchID()
{
	var string = location.search;
	if (string)
	{
		var showID=string.substring (string.indexOf("&f")+1, string.length);
		var re = new RegExp("f(\\d)+","ig");
		if (re.test(showID)) modifyTable(showID);
		else return;
	}
}

function openWindowTarget(url, width, height,target ) {
  w = window.open(url,target,"height="+height+",width="+width+",status=no,toolbar=no,menubar=no,location=no,resizable=no,top=100,left=100,scrollbars=yes");
  w.focus();
}


function openWindoScreenshot(img, name, width, height) {
	wind = window.open('','screenshot','width='+width+',height='+height+'menubar=0,resizable=1,scrollbars=0,top=100,left=100');
	wind.document.write("<html><head><title>"+name+"</title></head><body style=\"margin:0px;padding:0px;\"><img src=\"/upload/images/"+img+"\" width=\""+width+"\" height=\""+height+"\" border=\"0\" alt=\""+name+"\"><br></body></html>")
}

function showInfo (info,placeID) {
	if(document.getElementById(placeID)) document.getElementById(placeID).innerHTML=info;	
}

function doSection (secNum){
	//display the section if it's not displayed; hide it if it is displayed
	if (secNum.style.display=="none"){secNum.style.display=""}
	else{secNum.style.display="none"}
}

function noSection (secNum){
	//remove the section when user clicks in the opened DIV
	if (secNum.style.display==""){secNum.style.display="none"}
}

function doSectionLink (secID)
{
	//display the section if it's not displayed; hide it if it is displayed
	if (document.getElementById(secID).style.display=="")
	{
		document.getElementById(secID).style.display="none";
		document.getElementById(secID+"_open").style.display='';
		document.getElementById(secID+"_close").style.display='none';
	}
	else
	{
		document.getElementById(secID).style.display="";
		document.getElementById(secID+"_open").style.display='none';
		document.getElementById(secID+"_close").style.display='';
	}
}

// / 

function showID(id)
{
	if (document.getElementById(id).style.display=='')
		document.getElementById(id).style.display='none';
	else
		document.getElementById(id).style.display='';
}

function hideID(id)
{
	document.getElementById(id).style.display='none';
}


function setUrl (value,param,rep) {
	
		
		alert(document.location.pathname);
		document.location.pathname = document.location.pathname+ "new";
		
/*	var oldUrl=document.location.toString();
	if(oldUrl.indexOf(value)==-1) {
		
		prefix = (oldUrl.indexOf("?")>-1) ? ("&") : ("?");
		//alert(oldUrl.indexOf(param)>-1);
		switch (oldUrl.indexOf(param)>-1)
		{
		  case true:
		    reg=param+"="+/[a-z]+/;
			alert(reg);
		   newUrl = (rep==1) ? (oldUrl.replace(reg, param+"="+value)) : (oldUrl)
			break;
		  case false:  
		  alert('no');
			newUrl=oldUrl + prefix + param + "=" + value;
		}

	
		alert(newUrl);
		document.location.pathname = document.location.pathname+ "new";
		//alert(document.location.pathname);
		document.location=newUrl;
		return false;
		//alert(oldUrl);

	}
	*/
	
}

 function checkInfo(frm) {
 var q1;

 var dataRight=true;
 
 q1=frm.q1.value;
 
 if (q1.length==0)
 {
    dataRight=false;
    message="Пожалуйста, заполните все поля, отмеченные звездочками";
    window.alert(message);
   }
else
{
	 message="Спасибо! Ваша заявка на тестирование принята.";
	 window.alert(message);

}
   
 return dataRight;
}


	function setColors(){
	  nameID.style.color = "#000000";
	  fileID.style.color = "#000000";
	  emailID.style.color = "#000000";
	}
	function checkContestFields(frm) {
		var formReturn=true;
		var alertStr=',   ';
		if (frm.TextBoxName.value==""){
		  nameID.style.color = "#ff0000";
		  formReturn=false;
		}
		if (frm.TextBoxEMail.value==""){
		  emailID.style.color = "#ff0000";
		  formReturn=false;
		}
		if (frm.TextBoxEMail.value.search(/[0-9a-zA-Z_\-\.]+@([0-9a-zA-Z_\-]+\.[0-9a-zA-Z_\-]+(\.[0-9a-zZ-Z_\-]+)*)+$/)==-1){
		  emailID.style.color = "#ff0000";
		  alertStr +="\n  Email";
		  formReturn=false;
		}
		
		if (frm.FileUploadData.value==""){
		  fileID.style.color = "#ff0000";
		  formReturn=false;
		}
		if (!formReturn)
  		window.alert(alertStr);
		return formReturn;
	}
	

function openWindow_lookflash() {
		anatomy = window.open("/tools/Lingvo12.html","anatomyWindow","height=310,width=265,status=no,toolbar=no,menubar=no,location=no,resizable=no,top=100,left=500,scrollbars=no");
		anatomy.focus();
	}


var buyIDs = new Array ("multi1", "multi2", "euro1", "euro2", "english1", "english2")
function show_buy(buyID)
{
 for (var i=0;i<buyIDs.length;i++)
 {if (buyID != buyIDs[i]) document.getElementById(buyIDs[i]).style.display='none';}
 if (document.getElementById(buyID).style.display=='')
 document.getElementById(buyID).style.display='none';
 else
 document.getElementById(buyID).style.display='';
}