var _url = "http://www.radiatorsrus.com";
//var _url = "http://74.208.132.35/";
//var _url = "http://localhost/store";



/*if (Drupal.jsEnabled) {

	$(document).ready(function(){

		alert('ff');

		$('#catalogH1').change(function(){

			id = document.getElementById('catalogH1').value;

			$.ajax({

				url: "http://74.208.106.104:82/store/ajaxH.php?yid="+id,

				cache: false,

				success: function(html){

				$("#appendDivH2").html('');

				$("#appendDivH3").html('');

				$("#appendDivH4").html('');

				$("#appendDivH5").html('');

				$("#appendDivH2").append(html);

				}

			})

			return false;

		});

	});

}*/

function change_func(){

	

	id = document.getElementById('catalog1').value;

	$.ajax({

		url: _url+"/ajax.php?tid="+id,

		cache: false,

		success: function(html){

		$("#appendDiv2").html('');

		$("#appendDiv3").html('');

		$("#appendDiv4").html('');

		$("#appendDiv5").html('');

		is_not_liter = html.indexOf("LITERSNOTINAUTO");

		if(is_not_liter > 0){

			select_index = html.indexOf("</select>");

			res = html.substring(select_index+9);

			location.href = res;

		}
		else{
			$("#appendDiv2").append(html);
		}

		}

	})

}

function change_func_1(){


	tid = document.getElementById('catalog1').value;

	id 	= document.getElementById('catalog2').value;

	if(id == 00){

		id = "YEAR";

	}

	$.ajax({

		url: _url+"/ajax.php?yid="+id+"&tid="+tid,

		cache: false,

		success: function(html){

			$("#appendDiv3").html('');

			$("#appendDiv4").html('');

			$("#appendDiv5").html('');

			is_not_liter = html.indexOf("LITERSNOTINAUTO");

			if(is_not_liter > 0){

				select_index = html.indexOf("</select>");

				res = html.substring(select_index+9);

				location.href = res;

			}

			else{

				$("#appendDiv3").append(html);

			}

		}

	})

}



function change_func_2(){

	id 	= document.getElementById('catalog3').value;

	if(id == 00){

		id = "MAKE";

	}

	yid = document.getElementById('catalog2').value;

	if(!yid){

		yid = "YEAR";

	}

	if(yid == 00){

		yid = "YEAR";

	}

	tid = document.getElementById('catalog1').value;

	$.ajax({

		url: _url+"/ajax.php?mid="+id+"&yid="+yid+"&tid="+tid,

		cache: false,

		success: function(html){

			$("#appendDiv4").html('');

			$("#appendDiv5").html('');

			is_not_liter = html.indexOf("LITERSNOTINAUTO");

			if(is_not_liter > 0){

				select_index = html.indexOf("</select>");

				res = html.substring(select_index+9);

				location.href = res;

			}

			else{

				$("#appendDiv4").append(html);

			}

		}

	})

}



function change_func_3(){

	id 		= document.getElementById('catalog4').value;

	if(id == 00){

		id = "MODEL";

	}

	mid 	= document.getElementById('catalog3').value;

	if(!mid){

		mid = "MAKE";

	}

	if(mid == 00){

		mid = "MAKE";

	}

	tid 	= document.getElementById('catalog1').value;

	yid 	= document.getElementById('catalog2').value;

	if(!yid){

		yid = "YEAR";

	}

	if(yid == 00){

		yid = "YEAR";

	}



	$.ajax({

		url: _url+"/ajax.php?msid="+id+"&yid="+yid+"&mid="+mid+"&tid="+tid,

		cache: false,

		success: function(html){

			$("#appendDiv5").html('');
			
			is_not_liter = html.indexOf("LITERSNOTINAUTO");

			if(is_not_liter > 0){

				select_index = html.indexOf("</select>");

				res = html.substring(select_index+9);

				location.href = res;

			}

			else{

				$("#appendDiv5").append(html);

			}

		

		}

	})

}





function change_func_4(){

	tid 	= document.getElementById('catalog1').value;

	yid 	= document.getElementById('catalog2').value;

	if(!yid){

		yid = "YEAR";

	}

	if(yid==0){

		yid = "YEAR";

	}

	mid 	= document.getElementById('catalog3').value;

	if(!mid){

		mid = "MAKE";

	}

	if(mid==0){

		mid = "MAKE";

	}

	msid	= document.getElementById('catalog4').value;

	if(!msid){

		msid = "MODEL";

	}

	if(msid==0){

		msid = "MODEL";

	}

	lid		= document.getElementById('catalog5').value;

	

	if(yid && mid && msid && tid && lid){

		$.ajax({

			//url: _url+"/ajaxH.php?tid="+id+"&yid="+yid+"&mid="+mid+"&msid="+msid+"&eid="+eid,

			url: _url+"/ajax.php?tid="+tid+"&yid="+yid+"&mid="+mid+"&msid="+msid+"&lid="+lid,

			cache: false,

			success: function(html){
			html.replace(/&/,"%2526");
				location.href = _url+"/"+html;

			}

		})

	}

}