//------------------------------ RUTINA PARA ABRIR Y REESCALAR UNA VENTANA --------------------------//
// La llamada a la rutina se efectúa de la siguiente forma:
//
//	freescalar(url1,url2,posx,posy,ancho,alto,inc)	siendo:
//
//	url1: url de la página cargada inicialmente mientras se reescala la ventana
//	url2: url de la página que se cargará en la ventana una vez haya terminado de reescalarse
//	posx: coordenada x en la que queremos situar la ventana 
//	posy: coordenada y en la que queremos situar la ventana 
//	ancho: ancho final de la ventana
//	alto: ancho final de la ventana
//	inc: incremento en pixels de reescalado de la ventana


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



function insbanner1(){
	window.open('http://design.trademart.in/trademart/images/banner/tmbanner_automation2008_pop.html', 'automation2008', 'width=310, height=260')
	}
var openurl='';
var alto=100;
var ancho=100;
var anchofinal,altofinal=0;
var incremento=0;
var incx=0;
var incy=0;

function freescalar(url1,posx,posy,wfinal,hfinal,inc)
  {
	    window.open( "http://images.trademart.in/js/popup.html?" +url1, "one", "resizable=yes,scrollbars=yes,HEIGHT=514,WIDTH=450");
   }
	  
function freepdf(url1,posx,posy,wfinal,hfinal,inc)
  {
	    window.open( "" +url1, "one", "resizable=yes,scrollbars=yes,HEIGHT=514,WIDTH=450");
   }
	  	
	
function changelink(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}	
	


function checkSearch() {	
    if (document.searchForm.search.value=="")
       {
                alert("Kindly enter your search string");
                document.searchForm.search.focus();
                return false;
           }
		 /*  if (document.searchForm.searchby[0].checked == false && document.searchForm.searchby[1].checked == false && document.searchForm.searchby[2].checked == false ) {
				alert("Kindly select Company Name or Keywords.");
                document.searchForm.searchby[0].focus();
                return false;
		   }*/
		   if (document.searchForm.search.value.length != 0) {
		   	   if (document.searchForm.search.value.length <= 2) {
				   alert("Search string must contain at least 3 characters.");
				   document.searchForm.search.focus();
				   return false;	
			   }
		   }
		   else {
				return true;
		   }
		}

function checkSearch1() {
    if (document.searchForm1.search.value=="")
       {
                alert("Kindly enter your search string");
                document.searchForm1.search.focus();
                return false;
           }
		 /*  if (document.searchForm.searchby[0].checked == false && document.searchForm.searchby[1].checked == false && document.searchForm.searchby[2].checked == false ) {
				alert("Kindly select Company Name or Keywords.");
                document.searchForm.searchby[0].focus();
                return false;
		   }*/
		   if (document.searchForm1.search.value.length != 0) {
		   	   if (document.searchForm1.search.value.length <= 2) {
				   alert("Search string must contain at least 3 characters.");
				   document.searchForm1.search.focus();
				   return false;
			   }
		   }
		   else {
				return true;
		   }
}
function insbanner(){
	window.open('http://images.trademart.in/tata_banner/insurance_banner.html', 'insurance', 'width=600, height=210')
	}
function insbanner1(){
	window.open('http://design.trademart.in/trademart/images/banner/tmbanner_automation2008_pop.html', 'automation2008', 'width=310, height=260')
	}
function validateit(theForm) {
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.email.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		theForm.email.focus();
		return (false);
	}
}


function getblank(this1)  {
	if (this1.value = "Your e-mail here") {
		this1.value = "";
	}
    return true;
}
function openchild_nl(thisurl)
{
	browserName = navigator.appName;
	browserVer = parseInt(navigator.appVersion);
	condition = !(( (browserName.indexOf("Explorer") >=0 ) && (browserVer < 4) ) ||  ((browserName.indexOf("Netscape") >=0 ) && (browserVer < 2) ) ) ;
	if (condition == true  )
		CanAnimate = true;
	else
		CanAnimate = false;

	var email_val = document.theForm.email.value;
	var from_site_val = document.theForm.from_site.value;
	var is_window_val = document.theForm.is_window.value;
	var org_referer = document.theForm.org_referer.value;

	var thisurl_string = thisurl + "?email=" + email_val + "&from_site=" + from_site_val + "&is_window=" + is_window_val + "&org_referer=" + org_referer;

	if ( CanAnimate ) {
			msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=240,top=0,left=0');
			msgWindow.focus();
			msgWindow.location.href = thisurl_string;
	}
	else {
			msgWindow=window.open( thisurl_string,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=240,top=0,left=0');
	}
}
function convert()
{
var loc = document.location.toString();
loc = loc.substring(7,loc.length);

if (document.trans.langpair.selectedIndex != 0)
{
var newname = window.open('http://translate.google.com/translate_c?langpair=' + document.trans.langpair.value + "&u=" + document.location,"new_trans");
newname.focus();
return false;
}
else{
	alert('Kindly select a language.');
	document.trans.langpair.focus();
return false;
}
}

function checkblankb2b() {
if (document.form2.ss.value.length == 0)
{
	alert('Kindly enter your search string');
	document.form2.ss.focus();
	return false;
}

if (document.form2.ss.value.length != 0) {
	   if (document.form2.ss.value.length <= 2) {
		   alert("Search string must contain at least 3 characters.");
		   document.form2.ss.focus();
		   return false;
	   }
}
else {
	return true;
}

}

function convert1()
{
var loc = document.location.toString();
loc = loc.substring(7,loc.length);
if (document.trans1.langpair.selectedIndex != 0)
{
var newname = window.open('http://translate.google.com/translate_c?langpair=' + document.trans1.langpair.value + "&u=" + document.location,"new_trans");
newname.focus();
return false;
}
else{
	alert('Kindly select a language.');
	document.trans1.langpair.focus();
return false;
}
}


function convertnew_old(ln)
{
var loc = document.location.toString();
loc = loc.substring(7,loc.length);

var newname = window.open('http://translate.google.com/translate_c?langpair=' + ln + "&u=" + document.location,"new_trans");
newname.focus();
return false;

/*
if (document.trans1.langpair.selectedIndex != 0)
{
var newname = window.open('http://translate.google.com/translate_c?langpair=' + document.trans1.langpair.value + "&u=" + document.location,"new_trans");
newname.focus();
return false;
}
else{
	alert('Kindly select a language.');
	document.trans1.langpair.focus();
return false;
}*/

}


browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
condition = !(( (browserName.indexOf("Explorer") >=0 ) && (browserVer < 4) ) ||  ((browserName.indexOf("Netscape") >=0 ) && (browserVer < 2) ) ) ;
if (condition == true  )
    CanAnimate = true;
else
    CanAnimate = false;

function openchild(thisurl){
if ( CanAnimate ){
        msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=635,height=260,left=0,top=0');
        msgWindow.focus();
        msgWindow.location.href = thisurl;
}
else {
        msgWindow=window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=635,height=260,left=0,top=0');
}
}

function openchild12(thisurl){
if ( CanAnimate ){
        msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=400,height=450,left=0,top=0');
        msgWindow.focus();
        msgWindow.location.href = thisurl;
}
else {
        msgWindow=window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=635,height=260,left=0,top=0');
}
}

function openchildts(thisurl){

if ( CanAnimate ){

        var windowHeight;
        var windowWidth;
        var windowTop;
        var windowLeft;
        windowHeight=(screen.height*(80/100))*0.85;
        windowWidth=screen.width*(70/100);
        windowTop=(screen.height*(20/100))*0.8;
        windowLeft=screen.width*(28.5/100);

        msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,top='+windowTop+',left='+windowLeft+',width='+windowWidth+',height='+windowHeight);
        msgWindow.focus();
        msgWindow.location.href = thisurl;
}
else {
        msgWindow=window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=510,height=420');
}

}




function openloc(urlis)
{

//alert(window.location.href.indexOf("translate"));



if (window.location.href.indexOf("translate") == -1)
{

	urlis = "/cgi/openlink.pl?url="+urlis;
	window.location.href = urlis;
}else {
	urlis = window.location.href.substr(0,window.location.href.indexOf('&'))+"&u=http://ushahandloom.com/openlink.pl?url="+urlis;
	window.location.href = urlis;
}

return false;

}

function openlocml(lang,urlis)
{

//alert(window.location.href.indexOf("translate"));



if (window.location.href.indexOf("translate") == -1)
{

	urlis = "/cgi/openlink.pl?url="+urlis+'&lang='+lang;
	window.location.href = urlis;
}else {
	urlis = window.location.href.substr(0,window.location.href.indexOf('&'))+"&u=http://ushahandloom.com/openlink.pl?url="+urlis;
	window.location.href = urlis;
}

return false;

}

function checkData (myobj) {
	var myobj;
	if (myobj.ss.value.length < 3) {
		//if (myobj.kc[0].checked) {
			alert("Enter at least three characters for search.");
			myobj.ss.focus();
			return false;
		//} else {
		//	alert("Enter at least three characters for search on Company name.");
		//	myobj.ss.focus();
		//	return false;
		//}
	} else {
		return true;
	}
}

function convertnew(pattern)
{

/////////////////////////////////////////////////////////////
// Script to use language convertor
// By Saradhi
/////////////////////////////////////////////////////////////

	/// Configuration parameters //////////////
	var open_in_same_window = 0;
	//////////// End Of Configuration /////////////

	var my_location = unescape(document.location.toString());
	var new_location ='';
	var new_pattern = '';
	if (my_location.indexOf('translate_c?') != -1) {
		/// From google...
		var indexof_u = my_location.indexOf('u=');
		if (indexof_u == -1) {
			new_location = document.location;
		}
		else {
			var subs = my_location.substring(indexof_u, my_location.length);
			var ss = subs.split('&');
			new_location = ss[0].substring(2, ss[0].length);
		}
	}
	else {
		new_location = document.location;
	}

	indexof_p = pattern.indexOf('|');

	var isen = '';
	if (indexof_p == -1) {
		indexof_p1 = pattern.indexOf('><');
		if (indexof_p1 == -1) {
			new_pattern = pattern;
			if (pattern == 'en') {
				isen = 1;
			}
		}
		else {
			var psplit =pattern.split('><');
			new_pattern = psplit[0]+'|'+psplit[1];
			if (psplit[1] == 'en') {
				isen = 1;
			}
		}
	}
	else {
		var psplit = pattern.split('|');
		new_pattern = psplit[0]+'|'+psplit[1];
		if (psplit[1] == 'en') {
			isen = 1;
		}
	}

	var thisurl = '';
	if (isen == 1) {
		thisurl = new_location;
	}
	else {
		thisurl = 'http://translate.google.com/translate_p?langpair=' + new_pattern + '&u=' + new_location;
	}
	if (open_in_same_window == 1) {
		window.location.href = thisurl;
	}
	else {
		if (CanAnimate ){
			msgWindow=window.open('' ,'subwindow','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');
			msgWindow.focus();
			msgWindow.location.href = thisurl;
		}
		else {
			msgWindow=window.open(thisurl,'subwindow','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');
		}
	}


}



function checkData (myobj) {
	var myobj;
	if (myobj.ss.value.length < 3) {
			alert("Enter at least three characters for search on Company name.");
			myobj.ss.focus();
			return false;
	} else {
		return true;
	}
}

function funcText(url){
	//var vv = document.all.a.innerHTML;
	document.location=url;

}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf('#')!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
