function FreshList(side,id,company)
{
	post_data ="ajax=1&side="+side+"&id="+id+"&company="+company;
	loadHTML('POST','index.php', post_data, 'slidebuffer');
}

function FreshListCompany(url,PageNum)
{
	post_data ="ajax=1&pag="+PageNum;
	loadHTML('POST','index.php?'+url, post_data, 'freshlist');
}

function daychoose(day,parent)
{
	post_data ="ajax=1&day="+day+"&parent="+parent;
	loadHTML('POST','index.php', post_data, 'daysdiv');
}

function question(id)
{
	post_data ="ajax=1&question="+id;
	loadHTML('POST','index.php', post_data, 's-result');
}

function openform(id)
{
	document.getElementById(id).style.display="none";
	//document.getElementById('priem').style.display="none";
	/*var iWidth=500;var iHeight=300;
	var iRealWidth = iWidth ? iWidth : 800 ;
	var iRealHeight = iHeight ? iHeight : screen.height - 30 ;
	var iLeft = Math.round ((screen.width-500) / 2)-23;

	scrtop=document.documentElement.scrollTop;

	document.getElementById(id).style.marginLeft= iLeft+"px";
	document.getElementById(id).style.display="block";*/
	winobj = $("#"+id);
	wincenter(winobj);
	if(id=="addphoto")  document.getElementById("addphoto2").style.display="none";
	if(id=="enter")
	{
		document.getElementById("enter_companyname").focus();

	}
}

function sendform(id)
{	
	if(id=="opinions")
	{
		val1=document.getElementById("opinions_name").value;
		val2=document.getElementById("opinions_text").value;
		val3=document.getElementById("opinions_email").value;
		email_check=document.getElementById("opinions_email").value;

		check_dog="";
		point="";

		if(email_check!="")
		{
			point=0;
			dog=0;
			i=0;

			emailcheck_dog=email_check.search(/@/i);
			emailcheck_point=email_check.search(/\./i);



			if(emailcheck_point>=0 & emailcheck_dog>=0)
			{
				ec=1;
			}
			else
			{
				document.getElementById("opinions_email").style.backgroundColor="#ffc0c2";
				ec=0;
			}

		}
		else ec=1;

		if(val1!="Представьтесь" & val1!="" & val2!="Сообщение" & val2!="" & val3!="" & ec==1)
		{
			name = document.getElementById("opinions_name").value;
			text = document.getElementById("opinions_text").value;
			email = document.getElementById("opinions_email").value;

			post_data ="ajax=1&send_info=1&name="+name+"&text="+text+"&email="+email;
			loadHTML('POST','index.php', post_data, 'opinionsd');
		}
		else
		{
			if(val1=="" || val1=="Представьтесь") document.getElementById("opinions_name").style.backgroundColor="#ffc0c2";
			if(val2=="" || val2=="Ваши мысли") document.getElementById("opinions_text").style.backgroundColor="#ffc0c2";
			if(val3=="") document.getElementById("opinions_email").style.backgroundColor="#ffc0c2";

		}
	}

	if(id=="addphoto")
	{
		val1=document.getElementById("addphoto_name").value;
		val3=document.getElementById("addphoto_email").value;
		val4=document.getElementById("addphoto_file").value;
		email_check=document.getElementById("addphoto_email").value;

		check_dog="";
		point="";

		if(email_check!="")
		{
			point=0;
			dog=0;
			i=0;

			emailcheck_dog=email_check.search(/@/i);
			emailcheck_point=email_check.search(/\./i);



			if(emailcheck_point>=0 & emailcheck_dog>=0)
			{
				ec=1;
			}
			else
			{
				document.getElementById("addphoto_email").style.backgroundColor="#ffc0c2";
				ec=0;
			}

		}
		else ec=1;

		if(val1!="" & val3!="" & ec==1 & val4!="")
		{
			name = document.getElementById("addphoto_name").value;
			text = document.getElementById("addphoto_text").value;
			email = document.getElementById("addphoto_email").value;

			document.getElementById("addphotoform").submit();
		}
		else
		{
			if(val1=="") document.getElementById("addphoto_name").style.backgroundColor="#ffc0c2";
			if(val3=="") document.getElementById("addphoto_email").style.backgroundColor="#ffc0c2";
			if(val4=="") document.getElementById("addphoto_file").style.backgroundColor="#ffc0c2";
		}
	}
}

function closeform(id)
{
	document.getElementById(id).style.display="none";
}

function reloadstorefront(reloadcompanyid)
{
		if(reloadcompanyid=="no")
		{
			post_data ="ajax=1&reloadform=1";
			loadHTML('POST','index.php', post_data, 'storefrontdiv');
		}
		else
		{
			post_data ="ajax=1&reloadform=1&company="+reloadcompanyid;
			loadHTML('POST','index.php', post_data, 'storefrontdiv');
		}
}
function reloadstorefrontmain(reload_category,reload_subcategory)
{
	post_data ="ajax=1&reloadform=1&category="+reload_category+"&subcategory="+reload_subcategory;
	loadHTML('POST','index.php', post_data, 'storefrontdiv');
}