﻿///////////////////////////////////////////////////////
function hLiteLang(){
	//document.getElementById(pgLang).style.backgroundColor = "#FFFFCC";
	document.getElementById(pgLang).style.color='#fef0b6';
	//document.getElementById(pgLang).className = "clkedTransLnk";
}

///////////////////////////////////////////////////////
function hLiteObj(objName){
	document.getElementById(objName).style.color='#fef0b6';
}

///////////////////////////////////////////////////////
function setFormActionValue(value){   
  	document.getElementById('action').value = value;      
}

///////////////////////////////////////////////////////		
function scrollToTop(targetName) {
	document.body.scrollTop = 0;
}

///////////////////////////////////////////////////////	
function txtCounter(field, cntField, maxlimit) {
if (field.value.length > maxlimit)
	field.value = field.value.substring(0, maxlimit);
else 
	cntField.value = maxlimit - field.value.length;
}

///////////////////////////////////////////////////////	
function openOtherwindow(url, winName, w, h){
	var newW = w; //add border
	var newH = h; //add border
	var newwindow=window.open(url, winName, 'menubar=1,resizable=1, status=1,scrollbars=1, height='+newH+', width='+newW+', top=50, left=50');
	newwindow.resizeTo(newW, newH); //Just in case popup window is already open, the size specified in window.open does not take effect, so we need to resize it.
	newwindow.focus();
	return false;
}

///////////////////////////////////////////////////////	
function openOtherwindowWithAddress(url, winName, w, h){
	var newW = w; //add border
	var newH = h; //add border
	var newwindow=window.open(url, winName, 'menubar=1,resizable=1, status=1,scrollbars=1, location=1, height='+newH+', width='+newW+', top=50, left=50');
	newwindow.resizeTo(newW, newH); //Just in case popup window is already open, the size specified in window.open does not take effect, so we need to resize it.
	newwindow.focus();
	return false;
}

///////////////////////////////////////////////////////	

function IsImageOk(img) {
    if (!img.complete) {
		img.src = noImg;
    }
   
    if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) {
		img.src = noImg;
    }

    
}

///////////////////////////////////////////////////////	

function chkImage(){
	for (var i = 0; i < document.images.length; i++) {
       IsImageOk(document.images[i]);        
    }	
	
}

///////////////////////////////////////////////////////	
function showHideContent(id, show){
	var elem = document.getElementById(id);
	if (show){
		document.getElementById('someRegion').style.display = 'block';
		document.getElementById('someRegion').style.visibility = 'visible';
		document.getElementById('toggleTxt').innerHTML = "<input  type=\"button\" class=\"smallButtonStyle2\" onclick=\"javascript:showHideContent('someRegion',false,false)\" value=\" " + errorMsgArray['miniContact'] + " \">";
		
	} 
	else{
		document.getElementById('someRegion').style.display = 'none';
		document.getElementById('someRegion').style.visibility = 'hidden';
		document.getElementById('toggleTxt').innerHTML = "<input  type=\"button\" class=\"smallButtonStyle2\" onclick=\"javascript:showHideContent('someRegion',true,false)\" value=\" " + errorMsgArray['mayContactyou'] + " \">";
		
		
							
	}	
}  

///////////////////////////////////////////////////////	
//Trim white spaces of stringValue
function trim(stringValue)
{	
	
	return stringValue.replace(/^\s+|\s+$/g,"");
/* Put this in global js file later on

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

// trim, ltrim, and rtrim
var stringTest = " The boy cross the street ";
alert("*"+stringTest.trim()+"*");
alert("*"+stringTest.ltrim()+"*");
alert("*"+stringTest.rtrim()+"*");
*/
}
