var NS = document.layers;
var payWind;
var largeWin;
var smallWin;
var illegalChars= /[\<\>\\{\}\'\\\"\[\]]/
var strIllChars = "< > { } [ ] ' \\\ \"\ " 

function getObject(obj) {var theObj;if (document.all) {if (typeof obj == "string") {return document.all(obj)} else {return obj.style}}
if (document.getElementById) {if (typeof obj == "string") {return document.getElementById(obj)} else {return obj.style}}return null}


function openPop(thsUrl){
if (payWind && payWind.open && !payWind.closed) payWind.close();

payWind = window.open(thsUrl,"payWind","top=10,left=10,height=450,width=600,resizable,status,toolbar,scrollbars")
}

function openTextPreview(productId,storeId){
if (smallWin && smallWin.open && !smallWin.closed) smallWin.close();

smallWin = window.open("textpreview.php?pdid="+productId+"&sid="+storeId,"","top=5,left=5,height=400,width=400,resizable,status,scrollbars")
}

function openImagePreview(siteAddress,thsImageUrl){
if (smallWin && smallWin.open && !smallWin.closed) smallWin.close();

smallWin = window.open(siteAddress+"imagepreview.php?img="+thsImageUrl,"smallWin","top=5,left=5,height=400,width=500,resizable,status,scrollbars")
}


function chkCharacters(thsValue){

if (thsValue.match(illegalChars))return false;
return true; 
}

function trimInputValues(){
	for (i = 0;i<frmObjt.elements.length;i++ ){
		frmObjt.elements[i].value = trimSpaces(frmObjt.elements[i].value)
	} 

}


function trimSpaces(strInput) { 
    
    while (strInput.substring(0,1) == ' ') 
        strInput = strInput.substring(1, strInput.length);

    while (strInput.substring(strInput.length-1,strInput.length) == ' ')
        strInput = strInput.substring(0, strInput.length-1);

   return strInput;
}
