/* Updates Price using AJAX */
function updatePrice(price_div, form_id) {

        new Ajax.Updater(price_div, '/ajax/product.php', {asynchronous:true, evalScripts:true, parameters:Form.serialize(form_id)});

}


/* Change Tabs Content */
function changeTabContent(num_tabs, tab_num, tab_content) {

        // Set Tab Class
        var tabs_class = 'one-';
        if (num_tabs == 1) {
                tabs_class = 'one-';
        } else if (num_tabs == 2) {
                tabs_class = 'two-';
        } else if (num_tabs == 3) {
                tabs_class = 'three-';
        }
        if (tab_num == 1) {
                tabs_class += 'one-high';
        } else if (tab_num == 2) {
                tabs_class += 'two-high';
        } else if (tab_num == 3) {
                tabs_class += 'three-high';
        }
        $('product-tabs').className = tabs_class;

        // Set Tab Content
        $('tab_content_div').innerHTML = unescape(tab_content);

}


/* Form Validation */
function validateForm(id_value) {

        // Check if Size is selected
        if ($('size'+id_value)) {
                if ($('size'+id_value).value == 'Select Size') {
                        alert('Select a Size please.');
                        return false;
                }
        }

        // Check if Color is selected
        if ($('color'+id_value)) {
                if ($('color'+id_value).value == 'Select Color') {
                        alert('Select a Color please.');
                        return false;
                }
        }

        return true;

}


/* Popup color swatches*/
function popItUp(url) {
        newwindow=window.open(url,'name','height=80,width=80');
        if (window.focus) {newwindow.focus()}
        return false;
}
