//var ajax_transport = false;    
//var prev_page = '';
//var xmlHttp;
var load_msg = "<img src='http://www.funkymotors.ie/images/loading.gif' /> <b>loading...</b>";
var home_url = "http://alloywheels.funkymotors.ie/";
////////////////////////////////////////
//get model
function get_model(inputx,div,mode){
	var input = inputx;
	var content_show = document.getElementById(div);        
	content_show.style.visibility = "visible";
	//document.getElementById('size').disabled = true;
	content_show.innerHTML = load_msg;
	var callback = {
		success : function(o) {
			content_show.innerHTML = o.responseText;
			content_show.style.visibility = "visible";
		},
		failure : function(o) {
			content_show.innerHTML = o.responseText;
			content_show.style.visibility = "visible";
			content_show.innerHTML = "CONNECTION FAILED!";
		}
	}
	var url= home_url+"_get_data_inc.php?make="+ input + "&mode=" + mode + "&date=" + new Date().getTime();
	var conn = YAHOO.util.Connect.asyncRequest("GET", url, callback);
}

//get year
function get_year(make,model,div){
	//var input = inputx;
	var content_show = document.getElementById(div);        
	content_show.style.visibility = "visible";
	content_show.innerHTML = load_msg;
	//disable('size'); 
	//clear_sp('sp_img');
	var callback = {
		success : function(o) {
			content_show.innerHTML = o.responseText;
			content_show.style.visibility = "visible";
		},
		failure : function(o) {
			content_show.innerHTML = o.responseText;
			content_show.style.visibility = "visible";
			content_show.innerHTML = "CONNECTION FAILED!";
		}
	}
	var url= home_url+"_get_data_inc.php?make="+ make + "&model=" + model + (div == "year_txt" ? "&mode=text" : "")+"&date=" + new Date().getTime();
	var conn = YAHOO.util.Connect.asyncRequest("GET", url, callback);
}
//get wheel size
function get_size(make,model,year,div){
	//var input = inputx;
	//alert(div);
	var content_show = document.getElementById(div);        
	content_show.style.visibility = "visible";
	content_show.innerHTML = load_msg;
	var callback = {
		success : function(o) {
			content_show.innerHTML = o.responseText;
			content_show.style.visibility = "visible";
		},
		failure : function(o) {
			content_show.innerHTML = o.responseText;
			content_show.style.visibility = "visible";
			content_show.innerHTML = "CONNECTION FAILED!";
		}
	}
	var year = year.replace(".", "/");
	var year = year.replace(":", "-");
	var year = year.replace(".", "/");
	var year = year.replace(":", "-");
	var url= home_url+"_get_data_inc.php?make="+ make + "&model=" + model + "&year=" + year + (div == "size_txt" ? "&mode=text" : "") + "&date=" + new Date().getTime();
	//alert(url);
	var conn = YAHOO.util.Connect.asyncRequest("GET", url, callback);
}
//get products
function get_products(make,model,yearf,yeart,size,type,div){
	//var input = inputx;
	//alert(make,model,year,size,div);
	var content_show = document.getElementById(div);        
	content_show.style.visibility = "visible";
	content_show.innerHTML = "<h1>"+load_msg + " <b style='color:#990000;'>Please Wait We are Searching for Products...</b></h1>";
	var callback = {
		success : function(o) {
			content_show.innerHTML = o.responseText;
			content_show.style.visibility = "visible";
		},
		failure : function(o) {
			content_show.innerHTML = o.responseText;
			content_show.style.visibility = "visible";
			content_show.innerHTML = "CONNECTION FAILED!";
		}
	}
	var url= home_url+"_get_data_inc.php?make="+ make + "&model=" + model + "&year=" + yearf+"-"+yeart + "&size=" + size  + "&type=" + type + "&date=" + new Date().getTime();
	//alert(url);
	var conn = YAHOO.util.Connect.asyncRequest("GET", url, callback);
}
//disable form element
function disable(what){ 
document.getElementById(what).disabled = true; 
}
//activate form element
function activate(what){ 
document.getElementById(what).disabled = false; 
}
//get input value
function input_value(what){ 
	var what = document.getElementById(what).value;
	return what;
}
//clear span
function clear_sp(what){ 
document.getElementById(what).innerHTML = ""; 
}
//show and hide div
function show_hide(div){
	var myrow = document.getElementById(div);//MM_findObj(div);
	myrow.style.display=myrow.style.display=='none'?'':'none';
}
//change font size, color and weight
function change_font(what){ 
	var start_of_id = what.substr(0, 2);    /*find out which group of ids it belongs to, for example, "mk" */
    var allSpans = document.getElementsByTagName("span");
    for(i=0; i < allSpans.length; i++){    // loop through all the span elements    
        // identify the ones with starting with an id the same as the one that triggered the event
        if (allSpans[i].id.substr(0, 2) == start_of_id)   {
            // reset any span elements starting with id="start_of_id" to normal text
            allSpans[i].style.fontWeight = "normal";
            allSpans[i].style.color= "#000000";
            allSpans[i].style.fontSize = "10";
        }
    }

document.getElementById(what).style.fontSize = "12"; 
document.getElementById(what).style.fontWeight = "bold";
document.getElementById(what).style.color = "#990000";
} 
//add to shopping cart
//http://www.funkymotors.ie/aa_cart.php?cart_cmd=add&amp;p_id=$pid&amp;p_s_id=$p_s_id&amp;s_id=$sid
function add_to_cart(div,pid,psid,sid){
	var content_show = document.getElementById(div);        
	content_show.style.visibility = "visible";
	content_show.innerHTML = load_msg + " Adding to shopping cart...";
	var callback = {
		success : function(o) {
			content_show.innerHTML = o.responseText;
			content_show.style.visibility = "visible";
		},
		failure : function(o) {
			content_show.innerHTML = o.responseText;
			content_show.style.visibility = "visible";
			content_show.innerHTML = "CONNECTION FAILED!";
		}
	}
	var url= home_url+"aa_cart.php?cart_cmd=add&p_id="+ pid + "&p_s_id=" + psid + "&s_id=" + sid+"&date=" + new Date().getTime();
	//alert(url);
	var conn = YAHOO.util.Connect.asyncRequest("GET", url, callback);
}





  