
var action = "empty";

var cloth_first = null;
var cloth_second = null;
var cloth_third = null;

function ajaxFunction(data)
{
    var xmlhttp;
    if (window.XMLHttpRequest)
    {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
        // code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else
    {
        alert("Your browser does not support XMLHTTP!");
    }

    xmlhttp.onreadystatechange=function()
    {
        if(xmlhttp.readyState==4)
        {
            handleCallBack(xmlhttp.responseText);
        }
    }

    if(action == "clothSelection") {
        xmlhttp.open("GET","http://www.orkanlia.se/action/clothSelection&id=" + data['param_1'],true);
    }
    
    xmlhttp.send(null);
}

function handleCallBack(callBack) {
    clothSelectionCallBack(callBack);
}

function clothSelection(id, type) {

    var data = Array();

    action = "clothSelection";
    data['param_1'] = id;

    ajaxFunction(data);
}

function clothSelectionCallBack(clothData) {
    document.getElementById("selected_cloths").innerHTML = clothData;
}
