/*
translateCheckBoxForOmniture() translate the checkbox fields data using field_name .
The meaningful names are resolved by iterating the DOM at the client end
i.e. for the field the editor wants to capture the data,
field names are fetched from that input types labels in the DOM as the 
labels already contain the meaningful names for all functional components.
*/
function translateCheckBoxForOmniture(field_name){
	
var str = "";
var parentTag;
var o = document.createElement("INPUT");
o.setAttribute("type","hidden");
o.setAttribute("name",field_name + "TranslationData");
$("input[name=" + field_name + "]").each(function (i,arr) {
if(parentTag == undefined) {
parentTag = arr.parentNode;
}
str += arr.getAttribute("value");
str += "=";
str += $("label[for=" + arr.getAttribute("id") + "]:first").text();
str = str.replace('\n','');
str = str.replace('   ','');
str += ";";
});
o.setAttribute("value",str);
$(parentTag).append(o);
}
/*
translatedropdownForOmniture() translate the dropdown fields data using field_name .
The meaningful names are resolved by iterating the DOM at the client end
i.e. for the field the editor wants to capture the data,
field names are fetched from that select types labels in the DOM as the 
labels already contain the meaningful names for all functional components.
*/
function translatedropdownForOmniture(field_name){
	
var str = "";
var parentTag;
var o = document.createElement("INPUT");
o.setAttribute("type","hidden");
o.setAttribute("name",field_name + "TranslationData");
$("select[name=" + field_name + "]").children().each(function (i,arr) {
if(parentTag == undefined) {
parentTag = arr.parentNode;
}
if(arr.getAttribute("value")=="")
{
i++;
return true;
}
str += arr.getAttribute("value");
str += "=";
str += arr.innerHTML;
str += ";";
});
o.setAttribute("value",str);
$(parentTag).append(o);
}
