// JavaScript Document

function showValue(arg, arg2) {
	//alert("calling show me: arg1 " + arg + " arg2 " +  arg2);
	var s = (arg2==undefined) ? '' : "<br /><font color='darkgreen'>value:</font> "+ arg2;
	$("#selectedvalue").html("<font color='darkgreen'>label:</font> " + arg +  s);
}
function convertNow(byIds) {
	//MSDropDown.showIconWithTitle(false);
	try {
		if(byIds==undefined) {
			MSDropDown.init();
		} else {
			MSDropDown.init(byIds);
		}
		$("#converta").hide("fast");
		//$("#convertBtn").hide("fast");
	} catch(e) {
		//console.debug(e);
		alert(e);
	}
	$('#info').html('<h2>I would appreciate your <a style="color:chocolate" href="http://marghoobsuleman.com/node/103#comment-controls">feedback.</a></h2>');
}
var counter = 1;
function output(msg, id) {
	if(counter>=100) counter = 1;
	var  old = $("#output").html();
	$("#output").html((counter++)+": id= "+id.id +" : " + msg+"<br />"+old);
}
function clearDebugWindow() {
	counter = 1;
	$("#output").html("");
}

function disabledcombo(id, disabled) {
	document.getElementById(id).disabled = disabled;
	//custom function
	if(document.getElementById(id).refresh!=undefined)
			document.getElementById(id).refresh();
}
var cmbOption = new Object();
cmbOption["none"] = new Array("Please select and option");
cmbOption["prestashop"] = new Array("Extra Tab", "Categories Menu", "Add to cart extended", "Image Enlarger");
cmbOption["jquery"] = new Array("Javascript Image dropdown");
cmbOption["component"] = new Array("Magic Text", "Counter Text", "Rounded Text");
   
function populateCombo(val) {
	var targetCombo = 'dynamic';	
	var target_array = cmbOption[val];
	document.getElementById(targetCombo).options.length =0;
	for(var i=0;i<target_array.length;i++) {
		document.getElementById(targetCombo).options[i] = new Option(target_array[i].toString(), target_array[i].toString());
	}
	if(document.getElementById(targetCombo).refresh!=undefined)
			document.getElementById(targetCombo).refresh();

}