	
	
	//Variables
	var id = 0, mid = 0, wid = 0, kid = 0;
	var newG = "";
	
	//Sleeves
	var s1 = 0, s2 = 0, s3 = 0;
	var sid = 0;
	
	//Garments
	var g1 = "", g2 = "", g3 = "", g4 = "", g5 = "", g6 = "", g7 = "", g8 = "", g9 = "", g10 = "";
	var garment = "";
	
	var l1 = "", l2 = "", l3 = "", l4 = "", l5 = "", l6 = "", l7 = ""; 
	
	var f1 = "", f2 = "";
	
	
	var mcol = "", scol = "";
	
	var address = "http://www.kustomkit.com/search.php?";
	searchBool = false;



function SortID()
{
	if(mid == 1 && wid == 2 && kid == 3)
	{
		id = 123;
	}
	else if(mid == 1 && wid == 2 && kid == 0)
	{
		id = 12;
	}
	else if(mid == 1 && wid == 0 && kid == 3)
	{
		id = 13;
	}
	else if(mid == 0 && wid == 2 && kid == 3)
	{
		id = 23;	
	}
	else if(mid == 1 && wid == 0 && kid == 0)
	{
		id = 1;
	}
	else if(mid == 0 && wid == 2 && kid == 0)
	{
		id = 2;
	}
	else if(mid == 0 && wid == 0 && kid == 3)
	{
		id = 3;
	}
	else if(mid == 0 && wid == 0 && kid == 0)
	{
		id = 0;
	}
	else
	{
		id =id;
	}
	
	return id;

}

function SortSleeve()
{
	if(s1 == 1 && s2 == 2 && s3 == 3)
	{
		sid = 123;
	}
	else if(s1 == 1 && s2 == 2 && s3 == 0)
	{
		sid = 12;
	}
	else if(s1 == 1 && s2 == 0 && s3 == 3)
	{
		sid = 13;
	}
	else if(s1 == 0 && s2 == 2 && s3 == 3)
	{
		sid = 23;	
	}
	else if(s1 == 1 && s2 == 0 && s3 == 0)
	{
		sid = 1;
	}
	else if(s1 == 0 && s2 == 2 && s3 == 0)
	{
		sid = 2;
	}
	else if(s1 == 0 && s2 == 0 && s3 == 3)
	{
		sid = 3;
	}
	else if(s1 == 0 && s2 == 0 && s3 == 0)
	{
		sid = 0;
	}
	else
	{
		sid = sid;
	}
	
	return sid;

}

function SetChecked(text, bool, value)
{
		
	if (bool == true)
	{
		
		
		if (text == "mens"){
			mid = 1;
				
		}
		else if (text == "womens"){
			wid = 2;
				
		}
		else if (text == "kids"){
			kid = 3;
				
		}		
		else if (text == "shirts"){
			g1 = 1;		
		}
		else if (text == "polos"){
			g2 = 2;
		}
		else if (text == "t-shirtsandtops"){
			g3 = 318;	
		}
		else if (text == "fleece"){
			g4 = 6;	
		}
		else if (text == "rugbyshirt"){
			g5 = 22;	
		}
		else if (text == "shorts"){
			g6 = 20;	
		}
		else if (text == "apron"){
			g7 = 29;	
		}
		else if (text == "vest"){
			g8 = 34;	
		}
		else if (text == "tracksuits"){
			g9 = 21;	
		}
		else if (text == "sports"){
			g10 = 733;	
		}
		else if(value == "mcol")
		{
			mcol = text;			
		}
		else if(value == "scol")
		{
			scol = text;	
		}
		else if(text == "newG")
		{
			newG = 1;	
		}
		else if (text == "longsleeve")
		{
			s3 = 3
		}
		else if (text == "length3")
		{
			s2 = 2;			
		}
		else if (text == "shortsleeve")
		{
			s1 = 1; 	
		}
		else if (value == "fabric")
		{
			f1 = text;
		}
		else if (value == "logo")
		{
			l1 = text;
		}
		
		
		
	}
	else
	{
		if (text == "mens"){
			mid = 0;
				
		}
		else if (text == "womens"){
			wid = 0;
				
		}
		else if (text == "kids"){
			kid = 0;
				
		}		
		else if (text == "shirts"){
			g1 = "";		
		}
		else if (text == "polos"){
			g2 = "";
		}
		else if (text == "t-shirtsandtops"){
			g3 = "";	
		}
		else if (text == "fleece"){
			g4 = "";	
		}
		else if (text == "rugbyshirt"){
			g5 = "";	
		}
		else if (text == "shorts"){
			g6 = "";	
		}
		else if (text == "apron"){
			g7 = "";	
		}
		else if (text == "vest"){
			g8 = "";	
		}
		else if (text == "tracksuits"){
			g9 = "";	
		}
		else if (text == "sports"){
			g10 = "";	
		}
		else if(value == "mcol")
		{
			mcol = "";	
		}
		else if(value== "scol")
		{
			scol = "";	
		}
		else if(text == "newG")
		{
			newG = "";	
		}
		else if (text == "longsleeve")
		{
			s3 = 0
		}
		else if (text == "length3")
		{
			s2 = 0;			
		}
		else if (text == "shortsleeve")
		{
			s1 = 0; 	
		}
		
		else if (value == "fabric")
		{
			f1 = "";
		}
		else if (value == "logo")
		{
			l1 = "";
		}
		
				
	}
	
}

function ResetGarmentID()
{
	
	g1 = ""; g2 = ""; g3 = ""; g4 = ""; g5 = ""; g6 = ""; g7 = ""; g8 = ""; g9 = ""; g10 = "";
}

function ResetFabricID()
{
	
	l1 = ""; l2 = ""; l3 = ""; l4 = ""; l5 = ""; l6 = ""; l7 = ""; f1 = ""; f2 = "";
}

function GetAddress(lang)
{
	//Add garments
	mainAddress = address + "lang="+lang.value +"&id="+id+"&g1="+g1+"&g2="+g2+"&g3="+g3+"&g4="+g4+"&g5="+g5+"&g6="+g6+"&g7="+g7+"&g8="+g8+"&g9="+g9+"&g10="+g10;
	//Add sleeves
	mainAddress = mainAddress + "&sid="+sid;
	//Add colours
	mainAddress = mainAddress + "&mcol="+mcol+"&scol="+scol;
	//Add fabric
	mainAddress = mainAddress + "&f1="+f1+"&f2="+f2;
	mainAddress = mainAddress + "&l1="+l1+"&l2="+l2+"&l3="+l3+"&l4="+l4+"&l5="+l5+"&l6="+l6+"&l7="+l7;
	//Add new
	mainAddress = mainAddress + "&new="+newG;
	
	return mainAddress;
	
}



//Checks to see whether any checkboxes are checked
function Check()
{
	if (id==0 && newG=="" && sid==0 && mcol=="" && scol=="" && g1=="" && g2=="" && g3=="" && g4=="" && g5=="" && g6=="" && g7=="" && g8=="" && g9=="" && g10=="" && f1=="" && f2=="" && l1=="" && l2=="" && l3=="" && l4=="" && l5=="" && l6=="" && l7=="")
	{
		//alert("True");
		return true;
	}
	else
	{
		//alert("False");
		return false;
	}
	
}

function Update(colour)
{
	alert(colour.value);	
}

function CloseSearch()
{
	
	
	try
	{
		it = document.getElementById("actionsearch"); 
		it.style.visibility = 'hidden';
		it.style.display = 'none';
		
		it = document.getElementById("tabsystem");  
		it.style.visibility = 'visible';
		it.style.display = 'inline';
		//Reset text
		form = document.getElementById("formSearchBar");
		//form.textSearchBar.value = "";
		//form.textSearchBar.reset();
	}
	catch(err)
	{
		Shadowbox.close();
	}
	
}


