/*=======================================================================================================*/
/*@tt =====*/
/*@function: Open/Close LHS subnav DIV component */
/*=======================================================================================================*/

openDiv = 0;
function showzone(){
	
	var al=arguments.length,a=arguments;
	var output = "";
	var teamsiteserver = "RCIESNCME";
	var branchname = "/rogerstore/main/procurement/WORKAREA/common";
	var re_content=/\w+/;
	
	if(al==3 && a[0].match(re_content)){
		output += "<div class=\"showzone\" onMouseOver=\"this.style.background ='#ffffcc'\" onMouseOut=\"this.style.background=''\">";
		output += "<div class=\"header\">";
		output += "<a class=\"showzone\" href=\"http://" + teamsiteserver + "/iw/webdesk/edit?vpath=" + branchname + a[0] + "\" target=\"_blank\">";
		output += "EDIT :: " + a[1] + " " + a[2];
		output += "</a></div>";
	} else if (al == 0){
		output += "</div>";
	}
	document.write(output);
}

function expand(whichOne) {
	if(openDiv != 0) {
			if(openDiv == whichOne) {
				closeSub(whichOne);
				openDiv = 0;
			}
			else {
				closeSub(openDiv);
				openSub(whichOne);
				openDiv = whichOne;
				}
		}
	else {
			openSub(whichOne);
			openDiv = whichOne;
			}		
}

function openSub(whichOne) {
	plusminus = eval('document.all.indicator' + whichOne);
	subdiv = eval('document.all.sub' + whichOne);
	plusminus.src = '/Procurement/images/minus.gif';
	subdiv.style.display = '';
}

function closeSub(whichOne) {
	plusminus = eval('document.all.indicator' + whichOne);
	subdiv = eval('document.all.sub' + whichOne);
	plusminus.src = '/Procurement/images/plus.gif';
	subdiv.style.display = 'none';
}

function closeAll() {
	if (openDiv != 0) closeSub(openDiv);
}


/*=======================================================================================================*/



function PrintWindow() {
	window.print();
}


function Trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}


function ChangeLanguage(theLanguage) {
	dateObj = new Date("01/01/2050");
	document.cookie = "theburbs_Procurement=" + theLanguage + "; expires=" + dateObj.toGMTString() + "; path=/";
	
	var thisPageURL = new String(location.href);
	thisPageURL.toLowerCase;
	if(theLanguage == "FR") {
		window.location.href = thisPageURL.replace(/\/en\//i, "/fr/");
	}else if(theLanguage == "EN") {
		window.location.href = thisPageURL.replace(/\/fr\//i, "/en/");
	}
}
function emailcheck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid Email Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid Email Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid Email Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid Email Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid Email Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid Email Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid Email Address")
		    return false
		 }

 		 return true					
	}

