// Formats the given value to the user's Number format
function formatAmt(formName,amt) {

    var amtstr = amt.toString();
	var thousSep=',';// Thousands Seperator
    var decSep='.';// Decimal Symbol

	var nbrdec = 2; // Number of digits after decimal point

	var sInt = new String;
   	var sDec = new String;
   	var sTmp = new String;
   	var sTmp1 = new String;
   	var sTmp2 = new String;
   	var iLen = 0;                         1
   	var iNegPos = amtstr.indexOf('-');

   	if (iNegPos == 0) {
    	amtstr = amtstr.substring(1, amtstr.length);
   	}
   	var iPos = amtstr.indexOf('.');
   	if (iPos >= 0) {
    	sInt = amtstr.substring(0,iPos);
      	sDec = amtstr.substring(iPos + 1, amtstr.length);
   	} else {
    	sInt = amtstr.substring(0, amtstr.length);
      	sDec = '';
   	}
   	iLen = sDec.length;
   	if (iLen > nbrdec) {
    	if (sDec.substring(nbrdec, nbrdec + 1) < '5') {
        	sDec = sDec.substring(0, nbrdec);
       	} else {
        	var sDec1 = sDec.substring(nbrdec - 1, nbrdec);
          	var iDec1 = sDec1.valueOf();
          	iDec1 = iDec1 - (-1);
          	if (iDec1 == 10) {
            	sDec = sDec.substring(0, nbrdec);
          	} else {
            	sDec = sDec.substring(0, nbrdec - 1) + iDec1;
          	}
       	}
   	} else {
    	while (iLen < nbrdec) {
        	sDec = sDec + '0';
           	iLen = sDec.length;
       	}
   	}
   	sTmp = sInt;
   	iLen = sInt.length;
   	iPos = iLen - 3;
   	while (iPos > 0) {
    	sTmp1 	= sTmp.substring(0, iPos);
      	sTmp2 	= sTmp.substring(iPos, sTmp.length);
      	sTmp 	= sTmp1 + thousSep + sTmp2;
      	iPos	= iPos - 3;
   	}
   	if (iNegPos == 0) {
    	sTmp = '-' + sTmp;
   	}
   	if (sDec.length != '') {
    	sTmp = sTmp + decSep + sDec;
   	}
   	return sTmp;
}

// Formats the given value to the user's Money format
function formatMoney(formName, amt) {

    var currSymb='$';// Currency Symbol
	var sTmp = formatAmt(formName,amt);
   	return (currSymb + sTmp);
}

//Extracts the money value from the formatted string
function unFormatMoney(formName,amtStr) {
    var amtstr = trim(amtStr.toString()); // to make sure amtstr is a string
        amtstr=removeLeadingZeros(amtstr);

        var currSymb='$';// Currency Symbol
        var thousSep=',';// Thousands Seperator
        var decSep='.';// Decimal Symbol


	var sInt 		= new String;
   	var sDec 		= new String;
   	var iSymbPos 	= amtstr.indexOf(currSymb);
   	var sAmtStr	 	= amtstr;
   	var sTmp 		= new String;
   	var sTmp1 		= new String;
   	var sTmp2 		= new String;
   	if (iSymbPos >= 0) {
    	sAmtStr = sAmtStr.substring(0,iSymbPos) + sAmtStr.substring(iSymbPos + 1, sAmtStr.length);
   	}

   	sAmtStr = trim(sAmtStr);
   	var iDecPos 	= sAmtStr.indexOf(decSep);
   	var iThouPos 	= sAmtStr.indexOf(thousSep);

   	if (iDecPos >= 0) {
    	sInt 	= sAmtStr.substring(0,iDecPos);
      	sDec 	= sAmtStr.substring(iDecPos + 1, sAmtStr.length);
   	} else {
    	sInt 	= sAmtStr.substring(0, sAmtStr.length);
      	sDec 	= '0';
   	}

   	sTmp = sInt;
   	while (iThouPos > 0) {
    	sTmp1 		= sTmp.substring(0, iThouPos);
      	sTmp2 		= sTmp.substring(iThouPos+1, sTmp.length);
      	sTmp 		= sTmp1 + sTmp2;
      	iThouPos 	= sTmp.indexOf(thousSep);
   	}
   	sTmp = sTmp + '.' + sDec;
   	return sTmp;
}

function removeLeadingZeros(amtStr){
    var val=amtStr.toString();
    if(val.length<=1){//if the value is just 0, return 0
     return amtStr;
    }
    if(val=="0"){//if the value is just 0, return 0
     return amtStr;
    }
    //Remove Leading Zeros

    for(i=0,leadingZeros = 0; i < val.length; i++){
        if(val.charAt(i) == "0") leadingZeros++;
        else break;
    }
    if(leadingZeros>0){
        // remove leading zeros
        val = val.substr(leadingZeros);
    }
    return val;
}



function replaceStr (str,findString,replaceStr){
   s = new String(str);
   s = s.replace(findString,replaceStr);
   return s;
}

function thickBox(obj){
	var t = obj.title || obj.name || null;
	var g = obj.rel || false;
	TB_show(t,obj.href,g);
	obj.blur();
	return false;
}

function handleIt(imageObj,relativePath,imageName){
  eval('document.getElementById("'+imageName+'").href="javascript:;"');
  eval('document.getElementById("'+imageName+'").onfocus="this.blur();"');
  eval('document.getElementById("'+imageName+'").alt="Image Not Available"');
  eval('document.getElementById("'+imageName+'").onclick=""');
  eval('document.getElementById("'+imageName+'").rel=""');
  eval('document.getElementById("'+imageName+'").title=""');
  if(relativePath==''){
   imageObj.src = '/dealerweb/img/notavail.gif';
  }else{
   imageObj.src =relativePath+'/dealerweb/img/notavail.gif';
  }
}

function handleVehicleImages(imageObj,relativePath){
  if(relativePath==''){
   imageObj.src = '/dealerweb/img/notavail.gif';
  }else{
   imageObj.src =relativePath+'/dealerweb/img/notavail.gif';
  }

}

function setVarValue(formName,fieldName,value){
    eval('document.'+formName+'.'+fieldName+'.value=value');
}

function handleColorVehicleImages(imageObj,relativePath,altImage){
    var img = new Image();
     img.onload = function () {
        document.images[imageObj.id].src = altImage;
     }
     img.onerror = function () {
      //Set Not Avail Img
      if(relativePath==''){
       imageObj.src = '/dealerweb/img/notavail.gif';
      }else{
       imageObj.src =relativePath+'/dealerweb/img/notavail.gif';
      }
     }
    img.src = altImage;
}

function verify_images() {
    for (var i = 0; i < document.images.length; i++) {
        img = document.images[i];
        if (img.src.indexOf('images.anisidealers.com') >= 0) {
            w = img.width;
            h = img.height;
            if ((w == 1) || (h == 1)) {
                img.src = '../dealerweb/img/notavail.gif';
            } else if ((img.complete != null) && (!img.complete)) {
                img.src = '../dealerweb/img/notavail.gif';
            }
        }
    }
}

function ClearDivText(divName){
	document.getElementById(divName).innerHTML = '&nbsp;';
}

function setDivText(divName, txtInput,fontClass){
   if(fontClass!=''){
     document.getElementById(divName).innerHTML = '<FONT CLASS="'+fontClass+'">'+txtInput+'</FONT>';
   }else{
     document.getElementById(divName).innerHTML = txtInput;
   }
}


function setTimeStamp(formName,fieldName){
    var urlVar = new Date().getTime();
    eval('document.'+formName+'.'+fieldName+'.value=urlVar');
}
function popImg(object,img){
	var t = object.title || object.name || null;
	var g = object.rel || false;
	TB_show(t,object.href,g);
	object.blur();
	return false;
}
var currentClass="";
function changeColor(object,color){
    currentClass = object.className;
	object.className = color;
}

function validateMandatoryField(formName,fieldName,message)
{
   fieldval=eval('document.'+formName+'.'+fieldName+'.value');
   if(fieldval==''){
		alert(message);
		eval('document.'+formName+'.'+fieldName+'.focus()');
		return false;

   }
   return true;
}

// This function removes space from both ends of a string.
function trim(txt) {
    txt = txt.replace(/^(\s)+/, '');
    txt = txt.replace(/(\s)+$/, '');
    txt = txt.replace(/^[\s\xA0]+|[\s\xA0]+$/g, ''); //removes &#xa0;
   	return txt;
}

function validateDate(formName,datestr) {
	if(datestr=="")
	 return true;
    var datefmt='MM/DD/YYYY';// USER_DATE_FORMAT
    var datesep='/';// USER_DATE_SEPERATOR
    //var dateformatForDisplay=eval('document.'+formName+'.'+USER_DATE_FORMAT_FOR_DISPLAY+'.value');// USER_DATE_SEPERATOR
    var dateformatForDisplay=eval('document.'+formName+'.USER_DATE_FORMAT.value');// USER_DATE_SEPERATOR

	var iSepPos = datestr.indexOf(datesep);
	var sDateStr = datestr;
	var sStr1 = new String;
	var sStr2 = new String;
	var sStr3 = new String;
	var IsLeap = false;
	var iYear = 0;

	if (trim(datestr) == '') {
		return true;
	}

	if (datestr.length < 6) {
	    displayMessage('COMM',1019,datestr,dateformatForDisplay);
	    return false;
	}

	if (iSepPos > 0) {
	    sStr1 = sDateStr.substring(0,iSepPos);
	    sDateStr = sDateStr.substring(iSepPos + 1, sDateStr.length);
	}else {
	    displayMessage('COMM',1019,datestr,dateformatForDisplay);
	    return false;
	}
	iSepPos = sDateStr.indexOf(datesep);
	if (iSepPos > 0) {
	    sStr2 = sDateStr.substring(0,iSepPos);
	    sStr3 = sDateStr.substring(iSepPos + 1, sDateStr.length);
	}else {
	    displayMessage('COMM',1019,datestr,dateformatForDisplay);
	    return false;
	}

	while (datefmt.substr(datefmt.length-1,1)==' ') {
	   datefmt = datefmt.substr(0,datefmt.length-1);
	}

	var sMonth = '';
	var sDay = '';
	var sYear = '';
	if ((datefmt == 'MM/DD/YYYY') || (datefmt == 'M/D/YY') || (datefmt == 'MM/DD/YY') || (datefmt == 'M/D/YYYY')) {
	    sMonth = sStr1;
	    sDay = sStr2;
	    sYear = sStr3;
	}
	if ((datefmt == 'DD/MM/YYYY') || (datefmt == 'D/M/YY') || (datefmt == 'DD/MM/YY') || (datefmt == 'D/M/YYYY')) {
	    sDay = sStr1;
	    sMonth = sStr2;
	    sYear = sStr3;
	}
	if (datefmt == 'YY/MM/DD') {
	    sYear = sStr1;
	    sMonth = sStr2;
	    sDay = sStr3;
	}
	if ((((sYear.length - 0) > 4) || (((sYear.length - 0) < 4) && ((sYear.length - 0) != 2))) || ((sDay.length - 0) > 2) || ((sMonth.length - 0) > 2)    ) {
	    displayMessage('COMM',1019,datestr,dateformatForDisplay);
	    return false;
	}

	if (isNaN(sDay)) {
	    displayMessage('COMM',1019,datestr,dateformatForDisplay);
	    return false;
	}
	if (isNaN(sMonth)) {
	    displayMessage('COMM',1019,datestr,dateformatForDisplay);
	    return false;
	}
	if (isNaN(sYear)) {
	    displayMessage('COMM',1019,datestr,dateformatForDisplay);
	    return false;
	}

	if (sYear.length == 4) {
		if (((sYear - 0) < 1753) || ((sYear - 0) > 9999)) {
			displayMessage('COMM',1019,datestr,dateformatForDisplay);
	    	return false;
		}
	}
	iYear = iYear + sYear;

	if((iYear % 4) == 0) {
	   if((iYear % 100) == 0) {
	      if((iYear % 400) == 0) {
	         IsLeap = true;
	      }
	      else {
	         IsLeap = false;
	      }
	   }
	   else {
	      IsLeap = true;
	   }
	}
	else {
	   IsLeap = false;
	}

	if ((sMonth < 1) || (sMonth > 12)) {
		displayMessage('COMM',1019,datestr,dateformatForDisplay);
	    return false;
	}
	else {
		if ((sMonth == 1) || (sMonth == 3) || (sMonth == 5) || (sMonth == 7) || (sMonth == 8) || (sMonth == 10) || (sMonth == 12)) {
    		if ((sDay < 1) || (sDay > 31)) {
		    	displayMessage('COMM',1019,datestr,dateformatForDisplay);
		    	return false;
	    	}
		}
		if ((sMonth == 4) || (sMonth == 6) || (sMonth == 9) || (sMonth == 11)) {
			if ((sDay < 1) || (sDay > 30)) {
		    	displayMessage('COMM',1019,datestr,dateformatForDisplay);
		    	return false;
			}
		}
		if (sMonth == 2) {
	    	if (IsLeap == true) {
	        	if ((sDay < 1) || (sDay > 29)) {
	            	displayMessage('COMM',1019,datestr,dateformatForDisplay);
	    			return false;
	            }
	        }
	        else {
	        	if ((sDay < 1) || (sDay > 28)) {
	            	displayMessage('COMM',1019,datestr,dateformatForDisplay);
	    			return false;
				}
			}
		}
	}
 	return true;
}


function SetPopupWindow(w,h) {
     var winl = (screen.width - w) / 2;
     var wint = (screen.height - h) / 2;
     winprops = ',top='+wint+',left='+winl;
     return winprops;
}

function popUpWindow(urlVal,windowName,widthVal,heightVal,scrollBars,menuBar,reSizeable) {
	var paraString
	var wt
	var ht

	// Bug fix: we are now blanking the windowName variable
	windowName = "";
	wt = widthVal;
	ht = heightVal;

	origWinName = windowName;  //Addition for ICON

	paraString = "width=" + wt + ",height=" + ht;
	if (scrollBars == 1) {
		paraString = paraString + ",scrollbars=yes";
		} else {
		paraString = paraString + ",scrollbars=no";
		}
	if (menuBar == 1) {
		paraString = paraString + ",menubar=yes";
		}
	if (reSizeable == 1) {
		paraString = paraString + ",resizable=yes";
		}
	poppedWindow = window.open(urlVal,windowName,paraString);

}

// Function use to display videos on a separate popup
function popUpMedia(urlVal,widthVal,heightVal) {
	var wt = widthVal;
	var ht = heightVal + 103;

	popUpWindow(urlVal,"mediaWindow",wt,ht,0,0,0);
}

function popUpLink(urlVal,widthVal,heightVal) {
	var wt = widthVal;
	var ht = heightVal;

	popUpWindow(urlVal,"linkWindow",wt,ht,1,0,1);
}

function sendURL(urlVal) {
   document.location.href=urlVal;
}



function validateUSPhone(formName,fieldName) {
/************************************************
DESCRIPTION: Validates that a string contains valid
  US phone pattern.
  Ex. 999-999-9999

PARAMETERS:
   strValue - String to be tested for validity

RETURNS:
   True if valid, otherwise false.
*************************************************/
  fieldval=eval('document.'+formName+'.'+fieldName+'.value');
  var objRegExp  = /^[1-9]\d{2}\s?\d{3}\d{4}$/;
  //check for valid us phone with or without space between
  return objRegExp.test(fieldval);
}


function validateEmail( formName,fieldName) {

        str=eval('document.'+formName+'.'+fieldName+'.value');
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true
	}

function morphIt() {
    document.getElementById('SlideShow').style.filter = "blendTrans(duration=2)";
    document.getElementById('SlideShow').style.filter = "blendTrans(duration=fadeDuration)";
    document.getElementById('SlideShow').filters.blendTrans.Apply();
    document.getElementById('SlideShow').src = imageArray[j].src;
    document.getElementById('SlideShow').filters.blendTrans.Play();
    //document.images.SlideShow.style.filter = "blendTrans(duration=2)";
    //document.images.SlideShow.style.filter = "blendTrans(duration=fadeDuration)";
    //document.images.SlideShow.filters.blendTrans.Apply();
    //document.images.SlideShow.src = imageArray[j].src;
    //document.images.SlideShow.filters.blendTrans.Play();
    j++;
    if(j >= morphPic.length)
        j = 0;
    morphTimerId=setTimeout('morphIt()', speed);
}

function loadImg(ImageName){
 var i=new Image();
 i.src=ImageName;
 return i;
}

function swapImage(ImageId,ImageName){
 document.getElementById(ImageId).src=ImageName;
}

function swapVehicleColorImg(imgName) {
    var imgName='http://images.anisidealers.com/evox_AIL/color_0320/'+imgName;
	swapImage('vehicleColorImg',imgName);
}


//Vehicle Product Popup
/*function startExpand(e,element)	{
    var parentTable = element.parentNode.parentNode.parentNode.parentNode.parentNode;
	parentTable.className = "vehicle_expandable_fade";

	var fromElement = e.relatedTarget || e.fromElement;
	while (fromElement && fromElement != element && fromElement.nodeName != 'BODY')
		fromElement = fromElement.parentNode
	if (fromElement == element)
		return;

	var tableElement = element;
	var imgElement = tableElement.firstChild.firstChild.firstChild.firstChild.firstChild;
	if(!imgElement.inited)
		init(imgElement);

	//tableElement.style.width = tableElement.offsetWidth;
	tableElement.nextSibling.width = tableElement.offsetWidth;
	tableElement.nextSibling.height = tableElement.offsetHeight+1;
	tableElement.parentNode.style.position = "relative";
	tableElement.className = "vehicle_expanded";
	tableElement.parentNode.style.zIndex = 1;
	window.clearTimeout(imgElement.imgDelayID);
	imgElement.imgDelayID = window.setTimeout(imgElement.expand,300);
}*/

/*function endExpand(e,element){
    var parentTable = element.parentNode.parentNode.parentNode.parentNode.parentNode;
	parentTable.className = "";
    var toElement = e.relatedTarget || e.toElement;
	while(toElement && toElement != element && toElement.nodeName != 'BODY')
		toElement = toElement.parentNode;
	if(toElement == element)
		return;

	var tableElement = element;
	var imgElement = tableElement.firstChild.firstChild.firstChild.firstChild.firstChild;
	window.clearTimeout(imgElement.imgDelayID);
	hideElements(tableElement);
	imgElement.contract();
}*/

/*
function init(imgElement){
    imgElement.originalHeight = imgElement.height;
    imgElement.originalWidth = imgElement.width;
    imgElement.expand = function() {
						var factor = Math.round(imgElement.height*.06);
						if(imgElement.width + factor < imgElement.originalWidth*2.5){
							imgElement.width += factor;
							imgElement.height += factor;
							imgElement.imgDelayID = window.setTimeout(imgElement.expand,18);
						}else{
							imgElement.width = imgElement.originalWidth*2.5;
							imgElement.height = imgElement.originalHeight*2.5;
							var tableElement = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
							showElements(tableElement);
							if(tableElement.getAttribute("pushdown") == "1")
								tableElement.nextSibling.height = tableElement.offsetHeight+1;
						}
					};
	imgElement.contract = function() {
						var factor = Math.round(imgElement.height*.08);
						if(imgElement.width - factor > imgElement.originalWidth)
						{
							imgElement.width -= factor;
							imgElement.height -= factor;
							imgElement.imgDelayID = window.setTimeout(imgElement.contract,15);
						}
						else
						{
							imgElement.width = imgElement.originalWidth;
							imgElement.height = imgElement.originalHeight;

							var parentTable = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
							parentTable.className = "vehicle_expandable";
							parentTable.parentNode.style.position = "";
							parentTable.parentNode.style.zIndex = null;
							parentTable.nextSibling.height = "1";
							parentTable.nextSibling.width = "1";
						}
					};

	imgElement.inited = true;
}*/

function startExpand(e,element)	{
    var parentTable = element.parentNode.parentNode.parentNode.parentNode.parentNode;
	parentTable.className = "vehicle_expandable_fade";

	var fromElement = e.relatedTarget || e.fromElement;
	while (fromElement && fromElement != element && fromElement.nodeName != 'BODY')
		fromElement = fromElement.parentNode
	if (fromElement == element)
		return;

	var tableElement = element;
	var imgElement = tableElement.firstChild.firstChild.firstChild.firstChild.firstChild;
	if(!imgElement.inited)
		init(imgElement);

	//tableElement.style.width = tableElement.offsetWidth;
	tableElement.nextSibling.width = tableElement.offsetWidth;
	tableElement.nextSibling.height = tableElement.offsetHeight+1;
	tableElement.parentNode.style.position = "relative";
	tableElement.className = "vehicle_expanded";
	tableElement.parentNode.style.zIndex = 1;
	window.clearTimeout(imgElement.imgDelayID);
	imgElement.imgDelayID = window.setTimeout(imgElement.expand,300);
}

function endExpand(e,element){
    var parentTable = element.parentNode.parentNode.parentNode.parentNode.parentNode;
	parentTable.className = "";
    var toElement = e.relatedTarget || e.toElement;
	while(toElement && toElement != element && toElement.nodeName != 'BODY')
		toElement = toElement.parentNode;
	if(toElement == element)
		return;

	var tableElement = element;
	var imgElement = tableElement.firstChild.firstChild.firstChild.firstChild.firstChild;
	window.clearTimeout(imgElement.imgDelayID);
	hideElements(tableElement);
	imgElement.contract();
}


function init(imgElement){
    imgElement.originalHeight = imgElement.height;
    imgElement.originalWidth = imgElement.width;
    imgElement.expand = function() {
                    var tableElement = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
					showElements(tableElement);
					if(tableElement.getAttribute("pushdown") == "1")
								tableElement.nextSibling.height = tableElement.offsetHeight+1;
					if(imgElement.src.indexOf('thumb_images')>0){
                      imgElement.src=imgElement.src.replace('thumb_images','small_images');
                      imgElement.width=320;
                      imgElement.height=240;
                    }else{
                      imgElement.width=320;
                      imgElement.height=240;
                    }
					/*
						var factor = Math.round(imgElement.height*.06);
						if(imgElement.width + factor < imgElement.originalWidth*2.5){
							imgElement.width += factor;
							imgElement.height += factor;
							imgElement.imgDelayID = window.setTimeout(imgElement.expand,18);
						}else{
							imgElement.width = imgElement.originalWidth*2.5;
							imgElement.height = imgElement.originalHeight*2.5;
							var tableElement = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
							showElements(tableElement);
							if(tableElement.getAttribute("pushdown") == "1")
								tableElement.nextSibling.height = tableElement.offsetHeight+1;
						}*/
					};
	imgElement.contract = function() {
	                    imgElement.width = imgElement.originalWidth;
						imgElement.height = imgElement.originalHeight;
						if(imgElement.src.indexOf('small_images')>0){
                          imgElement.src=imgElement.src.replace('small_images','thumb_images');
                        }
							var parentTable = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
							parentTable.className = "vehicle_expandable";
							parentTable.parentNode.style.position = "";
							parentTable.parentNode.style.zIndex = null;
							parentTable.nextSibling.height = "1";
							parentTable.nextSibling.width = "1";
						/*var factor = Math.round(imgElement.height*.08);
						if(imgElement.width - factor > imgElement.originalWidth)
						{
							imgElement.width -= factor;
							imgElement.height -= factor;
							imgElement.imgDelayID = window.setTimeout(imgElement.contract,15);
						}
						else
						{
							imgElement.width = imgElement.originalWidth;
							imgElement.height = imgElement.originalHeight;

							var parentTable = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
							parentTable.className = "vehicle_expandable";
							parentTable.parentNode.style.position = "";
							parentTable.parentNode.style.zIndex = null;
							parentTable.nextSibling.height = "1";
							parentTable.nextSibling.width = "1";
						}*/
					};

	imgElement.inited = true;
}


function showElements(element){
var trElements = element.firstChild.childNodes;
if(trElements[1].nodeName != "SCRIPT"){
	if(trElements[1].firstChild.firstChild.nodeName == "SCRIPT")
		trElements[1].firstChild.childNodes[1].style.height = "";
	else
		trElements[1].firstChild.firstChild.style.height = "";
}

	for(var i=0;i<trElements.length;i++)
	{
		if(trElements[i].getAttribute("hideexp") == "1")
			trElements[i].style.display = "none";
		else
		{
			if(trElements[i].style.display == "none")
			{
				trElements[i].style.display = "";
				trElements[i].rehide = true;
			}
		}
	}
}

function hideElements(element){
var trElements = element.firstChild.childNodes;
if(trElements[1].nodeName != "SCRIPT"){
	if(trElements[1].firstChild.firstChild.nodeName == "SCRIPT")
		trElements[1].firstChild.childNodes[1].style.height = "30px";
	else
		trElements[1].firstChild.firstChild.style.height = "30px";
}

	for(var i=0;i<trElements.length;i++)
	{
		if(trElements[i].getAttribute("hideexp") == "1")
			trElements[i].style.display = "";

		if(trElements[i].rehide)
			trElements[i].style.display = "none";
	}
}