// JavaScript Document
/* @ By Gangadhar Gowd.B
for Cordys*/
var site="/cordysweb2.6/en/"
var seed=3
//window.onresize= screeen;
function insertBackslash(str){
	reg = /"/g;
	newstr = '\\"';
	return str.replace(reg,newstr);
}
function screeen()
{
	var d=document.body.clientWidth;
	var dd=window.innerWidth ;

	if(d<1000)
	{
		document.getElementById("bger").style.marginLeft ="0px"
		document.getElementById("bger").style.left ="0px"
	}
	else
	{
		document.getElementById("bger").style.marginLeft ="-497px"
		document.getElementById("bger").style.left ="50%"
	}

}
function newwin1(ul)
{
	var top=20;
	var left=20;
	win=window.open(ul,"Cordys","left=" + left + ",top=" + top + ",width=790,height=570" );
	win.focus();
}
function highlight()
{
	//screeen()
	var ul=window.location.pathname;
	var spliter=ul.split("/");

	document.getElementById("realize_soa_swap").style.display="none";
	document.getElementById("solutions_swap").style.display="none";
	document.getElementById("products_swap").style.display="none";
	document.getElementById("services_swap").style.display="none";
	document.getElementById("partners_swap").style.display="none";
	document.getElementById("customer_cases_swap").style.display="none";
	document.getElementById("about_us_swap").style.display="none";

	var dis=spliter[seed].toLowerCase()+"_swap";
	if(document.getElementById(dis))
	{
		document.getElementById(dis).style.display="inline";
		document.getElementById(spliter[seed].toLowerCase()).className="select";
	}

	if (spliter.length>(seed+2))
	{
		var str=spliter[seed+1].split("%40");
		spliter[seed+1]=str.join("@");
		document.getElementById(spliter[seed+1].toLowerCase()).className="select";
		textarr=spliter[seed+1].split("_");
		text=textarr.join(" ");
	}
}
function anstrailerfun() {
	var ul=window.location.pathname;
	var spliter=ul.split("/");
	anstrailer="<a href="+site+"Home.html>home</a>"
	title="Cordys / "
	var cc=site
	for (i=seed; i<=(spliter.length-2);i++)
	{
		textarr=spliter[i].split("_");
		text=textarr.join(" ");
		if (spliter[i].toLowerCase() =="search")
			cc=cc+spliter[i]+"/search.asp"
		else
			cc=cc+spliter[i]+"/"
		anstrailer=anstrailer+"  / <a href="+cc+">"+text+"</a>"
		title=title+text+" / "
	}
	document.getElementById("trailer").innerHTML=anstrailer;
	if (spliter[seed].toLowerCase()=="about_us")
		document.getElementById("news_banner").style.display="none";
	
	document.getElementById("spotlight").style.display="none";
		
}
function disabelalli()
{
	var ul=window.location.href;
	var spliter=ul.split("?");
	var dd=window.document.referrer;
	if  (dd=="http://alliances.cordys.com/iPortal_Global/frame/desktop.htm")
	{
		disabel()
		for(i=0;i<document.getElementsByTagName("a").length;i++)
		{
			var inner2=document.getElementsByTagName("a").item(i).innerHTML;
			document.getElementsByTagName("a").item(i).href=document.getElementsByTagName("a").item(i).href+"?from=alliance";
			document.getElementsByTagName("a").item(i).innerHTML=inner2;
		}
	}
	else if ((spliter.length>1)&& (spliter[1].toLowerCase()=="from=alliance"))
	{
	
			for(i=0;i<document.getElementsByTagName("a").length;i++)
			{
				var ul1=document.getElementsByTagName("a").item(i).href;
				var spliterin=ul1.split("downloadinfonew.asp");

				if (spliterin.length<1) {
					var inner2=document.getElementsByTagName("a").item(i).innerHTML;
					document.getElementsByTagName("a").item(i).href=document.getElementsByTagName("a").item(i).href+"?from=alliance";
					document.getElementsByTagName("a").item(i).innerHTML=inner2;
				}
			}
		disabel()
	}
}
function disabel() { 
	document.getElementById("header").style.display="none";
	document.getElementById("side_menu_id").style.display="none";
	document.getElementById("search_bar").style.display="none";		
	document.getElementById("side_menu_right").style.display="none";
	document.getElementById("footer").style.display="none";

	document.getElementById("bger").style.marginLeft ="0px";
	document.getElementById("bger").style.left ="0px";

	document.getElementById("bger").style.position ="relative";
	document.getElementById("bger").style.width ="auto";
	document.body.style.background ='#fff url(http://www.cordys.com/ims/spacer_white.gif) center top no-repeat';	
	document.body.style.height="100%";
	document.body.style.width="98%";

	document.getElementById("container").style.width="auto"
	document.getElementById("home_body").style.width="auto"
	document.getElementById("body_content").style.width="550px"

	if(document.getElementById("alliancenews")) document.getElementById("alliancenews").style.display="none";	
	if(document.getElementById("alliancenews1")) document.getElementById("alliancenews1").style.display="none";	
	if(document.getElementById("alliancenews2")) document.getElementById("alliancenews2").style.display="none";	
	if(document.getElementById("alliancenews3")) document.getElementById("alliancenews3").style.display="none";	
}
function friend() {
	ul=window.location.href;
	w = 550;
	h = 470;
	wleft = (screen.width - w) / 2;
	wtop = (screen.height - h) / 2;
	var win = window.open(site+"call_out/friend.asp",   "friend",    'width=' + w + ', height=' + h + ', ' +    'left=' + wleft + ', top=' + wtop + ', ' +    'location=no, menubar=no, ' +    'status=no, toolbar=no, scrollbars=no, resizable=no');
	win.resizeTo(w, h);
	win.moveTo(wleft, wtop);
	win.focus();
}
function comment() {
	ul=window.location.href;
	w = 550;
	h = 350;
	wleft = (screen.width - w) / 2;
	wtop = (screen.height - h) / 2;
	var win = window.open(site+"call_out/callout.asp",   "friend",    'width=' + w + ', height=' + h + ', ' +    'left=' + wleft + ', top=' + wtop + ', ' +    'location=no, menubar=no, ' +    'status=no, toolbar=no, scrollbars=no, resizable=no');

	win.resizeTo(w, h);
	win.moveTo(wleft, wtop);
	win.focus();
}
function commnetclose() {
	window.opener.location.href="/cordyscms_com/contactus.php";
	window.close();
}
function friendpri()
{
	window.opener.location.href="/cordyscms_com/privacy_policy.php#Privacy";
}
function pfv() {
	var win = window.open(site+"call_out/print.html",   "Print", 'width=650, height=650, left=10, top=10, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes');

}
/*email Checking*/
function echeck(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 E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
 		 return true					
	}
function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";
	var iTemp = 0;
	while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
	iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function
function search()
{
	if(document.frmDefault.searchText.value=="" || document.frmDefault.searchText.value=="Search") 
	{
		alert("Please Enter search key word");
		document.frmDefault.searchText.focus();
		return false;
	}
	return true
}
function jump(str1)
{
	var strHref = window.location.href
	replaceChars(strHref,str1)
}

function replaceChars(entry,rep) {
	out = entry // replace this
	add = rep; // with this
	temp = "" + entry; // temporary holder
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + 
		temp.substring((pos + out.length), temp.length));
	}
	window.location.href=temp;
}

// Function for calling popups in center of the screen. Added by Arun Thota on 22/10/07

function cordysOpenPopupPage(url,height,width) {

     //Get center pos of the screen
     var top=(screen.height-height)/2;
     var left=(screen.width-width)/2;
     win=window.open(url,"referPage","left=" + left + ",top=" + top + ",width="+width+",height="+height );
     if(win) {
          win.focus()
     }
	}
