function UpdateStyleVar(item_ID) { item_style = ""; all4one = false; if (typeof document.viz_form["all4one_" + item_ID] != "undefined") { all4one = document.viz_form["all4one_" + item_ID].checked; } if (all4one) { for (var tmp_prop in document.viz_form) { if (tmp_prop.indexOf("_top") != -1 && tmp_prop.indexOf(item_ID + "[") != -1 && tmp_prop.indexOf("[") != -1) { if (tmp_prop.indexOf("color") > 0) { tmp_prop = replace(tmp_prop, "[", "_"); tmp_prop = replace(tmp_prop, "]", ""); } //alert(tmp_prop + " = " + item_ID); bottom_prop = replace(tmp_prop, "_top", "_bottom"); left_prop = replace(tmp_prop, "_top", "_left"); right_prop = replace(tmp_prop, "_top", "_right"); document.viz_form[bottom_prop].value = document.viz_form[tmp_prop].value; document.viz_form[left_prop].value = document.viz_form[tmp_prop].value; document.viz_form[right_prop].value = document.viz_form[tmp_prop].value; if (tmp_prop.indexOf("color") > 0) { convertHex(bottom_prop, document.viz_form[tmp_prop].value); convertHex(left_prop, document.viz_form[tmp_prop].value); convertHex(right_prop, document.viz_form[tmp_prop].value); } } } } for (var tmp_prop in document.viz_form) { if (tmp_prop.indexOf(item_ID + "[") != -1 && tmp_prop.indexOf("[") != -1 && tmp_prop.indexOf("new_file_name") == -1 && tmp_prop.indexOf("file_type_group") == -1 && tmp_prop.indexOf("file_process_options") == -1) { js_prop = tmp_prop.split("["); js_prop = js_prop[1]; if (js_prop.indexOf("tmp_") == -1) { js_prop = js_prop.substring(0, js_prop.length - 1); css_prop = replace(js_prop, "_", "-"); if (tmp_prop.indexOf("color") > 0) { tmp_prop = replace(tmp_prop, "[", "_"); tmp_prop = replace(tmp_prop, "]", ""); } tmp_val = document.viz_form[tmp_prop].value; if (css_prop.indexOf("olor") != -1 && tmp_val.indexOf("#") == -1) { tmp_val = "#" + tmp_val; } if (js_prop.indexOf("background_image") >= 0) { if (tmp_val == "") { tmp_val = GetIdProp(item_ID + '_preview', 'backgroundImage'); } } if (js_prop.indexOf("background_image") == -1 || (js_prop.indexOf("background_image") >= 0 && tmp_val != "")) { item_style += css_prop + ":" + tmp_val + ";"; } } } } item_ID = replace(item_ID, "tmp_", ""); //alert(item_style); document.getElementById(item_ID).value = item_style; PreviewStyle("tmp_" + item_ID); } function PreviewStyle(item_ID) { item_ID = replace(item_ID, "tmp_", ""); item_style = document.getElementById(item_ID).value; //alert(item_style); item_style = item_style.split(";"); for (i = 0; i < item_style.length; ++i) { item_style[i] = item_style[i].split(":"); tmp_val = ""; for (j = 0; j < item_style[i].length; ++j) { if (j == 0) { js_prop = replace(item_style[i][0], "-", "_"); while (js_prop.indexOf("_") > 0) { next_letter = js_prop.substr(js_prop.indexOf("_") + 1, 1); js_prop = replace(js_prop, "_" + next_letter, next_letter.toUpperCase()); } } else { tmp_val += ":" + item_style[i][j]; } } tmp_val = tmp_val.substring(1, tmp_val.length); if (js_prop != "" && js_prop.indexOf("backgroundFade") == -1) { if (js_prop.indexOf("backgroundImage") == -1 || (js_prop.indexOf("backgroundImage") >= 0 && tmp_val != "")) { SetIdProp("tmp_" + item_ID + "_preview", js_prop, tmp_val); } } if (js_prop != "" && js_prop.indexOf("backgroundFade") > -1) { img_back = GetIdProp("tmp_" + item_ID + "_preview", "backgroundImage"); img_fade = parseInt(tmp_val); if (img_back.indexOf("/img_") >= 0) { img_back = img_back.replace(/\/img_/g, "/imgf_" + img_fade + "_"); } else if (img_back.indexOf("/imgf_") >= 0) { img_back = img_back.replace(/\/imgf_([0-9]{1,3})_/g, "/imgf_" + img_fade + "_"); } SetIdProp("tmp_" + item_ID + "_preview", "backgroundImage", img_back); } } //alert(item_ID + "\n" + item_style); }