/* changes form field string to init caps
add to each form field: onBlur="javascript:changeCase(this.form.fieldname)" */

function changeCase(frmObj) {
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strlen;
tmpStr = frmObj.value.toLowerCase();
strLen = tmpStr.length;
if (strLen > 0)
{
for (index = 0; index < strLen; index++)
{
if (index == 0)
{
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,strLen);
tmpStr = tmpChar + postString;
}
else {
tmpChar = tmpStr.substring(index, index+1);
if (tmpChar == " " && index < (strLen-1))
{
tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
preString = tmpStr.substring(0, index+1);
postString = tmpStr.substring(index+2,strLen);
tmpStr = preString + tmpChar + postString;
}
}
}
}
frmObj.value = tmpStr;
}


function toggle(tElem){
     var elem = document.getElementById(tElem);
     elem.style.display = (elem.style.display == "none")? "":"none";
}

function toggle_open(tElem){
     var elem = document.getElementById(tElem);
     elem.style.display = "";
}

function toggle_close(tElem){
     var elem = document.getElementById(tElem);
     elem.style.display = "none";
}


function viewcolor() {
	
    dest= "http://www.qcoleccion.com/color.html";
    window.open(dest,null,"top=150,left=150,height=300,width=300,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
}


function viewproduct(pdt) {
	
    dest= "http://www.qcoleccion.com/product/"+pdt;
    window.open(dest,null,"top=150,left=150,height=600,width=700,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
}
