var _CurrentMenu = 'homeContent.aspx';

//$(function(){
//	var LoadMsg = 'Please Wait ...';
//	$('a').live("click",function(){
//    	if(!$(this).hasClass("current")) {
//        var _Div = "";
//		var _Href = $(this).attr('href');
//		var _ExitFlag = false;
//		switch(_CurrentMenu)
//		{			
//			case "homeContent.aspx":
//				document.getElementById('menuHome').bgColor="#FF8400";
//				$("#headHome").attr({src : "images/menu/headHome2.png"});
//				break;
//			case "services.aspx":
//				document.getElementById('menuServices').bgColor="#FF8400";
//				$("#headServices").attr({src : "images/menu/headServices2.png"});
//				break;
//			case "Portfolio.aspx":
//				document.getElementById('menuPortfolio').bgColor="#FF8400";
//				$("#headProjects").attr({src : "images/menu/headProjects2.png"});
//				break;
//			case "Hosting.aspx":
//				document.getElementById('menuHosting').bgColor="#FF8400";
//				$("#headHosting").attr({src : "images/menu/headHosting2.png"});
//				break;
//			case "aboutus.aspx":
//				document.getElementById('menuAboutUs').bgColor="#FF8400";
//				$("#headAboutUs").attr({src : "images/menu/headAboutUs2.png"});
//				break;
//			default:
//				//$("#menuHome").attr({bgcolor : "#FF8400"}); 
//				//$("#headHome").attr({src : "images/menu/headHome2.png"});
//				break;
//		};
//		var filename = $(this).attr('href');
//		if(filename != "http://boroughofroselle.com/beta" &&
//		   filename != "http://boroughofroselle.com/beta/" &&
//		   filename != "http://technucon.com" &&
//		   filename != "http://technucon.com/" &&
//		   filename != "http://saketenergies.in" &&
//		   filename != "http://saketenergies.in/" &&
//		   filename != "http://chaudhari.gnextsoftwares.com" &&
//		   filename != "http://chaudhari.gnextsoftwares.com/" &&
//		   filename != "http://sahjanandconstruction.com" &&
//		   filename != "http://sahjanandconstruction.com/" &&
//		   filename != "http://traveltopindia.com" &&
//		   filename != "http://traveltopindia.com/")
//		{
//		    filename = $(this).attr('href').substring($(this).attr('href').lastIndexOf('/')+1) 
//		}
//		switch(filename)
//		{
//			case "http://boroughofroselle.com/beta":
//			case "http://boroughofroselle.com/beta/":
//				window.open($(this).attr('href'));
//				_ExitFlag = true;
//				document.getElementById('menuPortfolio').bgColor="#C00000";
//				$("#headProjects").attr({src : "images/menu/headProjects.png"});
//				break;
//			case "http://technucon.com":
//			case "http://technucon.com/":
//				window.open($(this).attr('href'));
//				_ExitFlag = true;
//				document.getElementById('menuHosting').bgColor="#C00000";
//				$("#headHosting").attr({src : "images/menu/headHosting.png"});
//				break;
//			case "http://saketenergies.in":
//			case "http://saketenergies.in/":
//				window.open($(this).attr('href'));
//				_ExitFlag = true;
//				document.getElementById('menuPortfolio').bgColor="#C00000";
//				$("#headHosting").attr({src : "images/menu/headProjects.png"});
//				break;
//			case "http://chaudhari.gnextsoftwares.com":
//			case "http://chaudhari.gnextsoftwares.com/":
//				window.open($(this).attr('href'));
//				_ExitFlag = true;
//				document.getElementById('menuPortfolio').bgColor="#C00000";
//				$("#headProjects").attr({src : "images/menu/headProjects.png"});
//				break;
//			case "http://sahjanandconstruction.com":
//			case "http://sahjanandconstruction.com/":
//				window.open($(this).attr('href'));
//				_ExitFlag = true;
//				document.getElementById('menuPortfolio').bgColor="#C00000";
//				$("#headProjects").attr({src : "images/menu/headProjects.png"});
//				break;
//			case "http://traveltopindia.com":
//			case "http://traveltopindia.com/":
//				window.open($(this).attr('href'));
//				_ExitFlag = true;
//				document.getElementById('menuPortfolio').bgColor="#C00000";
//				$("#headProjects").attr({src : "images/menu/headProjects.png"});
//				break;
//			case "mailto:careers@gnextsoftwares.com":
//				window.open($(this).attr('href'));
//				_ExitFlag = true;
//				_CurrentMenu = "";
//				break;
//			case "more-head.html":
//				_Div = "HeaderContainerDiv";
//				document.getElementById('menuHome').bgColor="#C00000";
//				$("#headHome").attr({src : "images/menu/headHome.png"});
//				_CurrentMenu = "Default.aspx";
//				break;
//			case "Default.aspx":
//			  _Div = "ContentDiv";
//				_Href = "homeContent.aspx";
//				document.getElementById('menuHome').bgColor="#C00000";
//				$("#headHome").attr({src : "images/menu/headHome.png"});
//				_CurrentMenu = "Default.aspx";
//				break;
//			case "services.aspx":
//			    _Div = "ContentDiv";
//				_Href = "services.aspx";
//				document.getElementById('menuServices').bgColor="#C00000";
//				$("#headServices").attr({src : "images/menu/headServices.png"});
//				_CurrentMenu = "services.aspx";
//				break;
//			case "Portfolio.aspx":
//			    _Div = "ContentDiv";
//				_Href = "Portfolio.aspx";
//				document.getElementById('menuPortfolio').bgColor="#C00000";
//				$("#headProjects").attr({src : "images/menu/headProjects.png"});
//				_CurrentMenu = "Portfolio.aspx";
//				break;
//			case "Hosting.aspx":
//			    _Div = "ContentDiv";
//				_Href = "Hosting.aspx";
//				document.getElementById('menuHosting').bgColor="#C00000";
//				$("#headHosting").attr({src : "images/menu/headHosting.png"});
//				_CurrentMenu = "Hosting.aspx";
//				break;
//			case "aboutus.aspx":
//			    _Div = "ContentDiv";
//				_Href = "aboutus.aspx";
//				document.getElementById('menuAboutUs').bgColor="#C00000";
//				$("#headAboutUs").attr({src : "images/menu/headAboutUs.png"});
//				_CurrentMenu = "aboutus.aspx";
//				break;
//			case "websites.aspx":
//				_Div = "ContentDiv";
//				_Href = "websites.aspx";
//				_CurrentMenu = "";
//				break;
//			case "desktopapplications.aspx":
//				_Div = "ContentDiv";
//				_Href = "desktopapplications.aspx";
//				_CurrentMenu = "";
//				break;
//			case "mobilewebsites.aspx":
//				_Div = "ContentDiv";
//				_Href = "mobilewebsites.aspx";
//				_CurrentMenu = "";
//				break;
//			case "quote.aspx":
//				_Div = "ContentDiv";
//				_Href = "quote.aspx";
//				_CurrentMenu = "";
//				break;
//			case "domain.aspx":
//				_Div = "ContentDiv";
//				_Href = "domain.aspx";
//				_CurrentMenu = "";
//				break;
//			case "webspace.aspx":
//				_Div = "ContentDiv";
//				_Href = "webspace.aspx";
//				_CurrentMenu = "";
//				break;
//			case "counters.aspx":
//				_Div = "ContentDiv";
//				_Href = "counters.aspx";
//				_CurrentMenu = "";
//				break;
//			case "homeContent.aspx":
//				_Div = "ContentDiv";
//				_Href = "homeContent.aspx";
//				document.getElementById('menuHome').bgColor="#C00000";
//				$("#headHome").attr({src : "images/menu/headHome.png"});
//				_CurrentMenu = "homeContent.aspx";
//				break;
//			case "contactus.aspx":
//				_Div = "ContentDiv";
//				_Href = "contactus.aspx";
//				_CurrentMenu = "";
//				break;
//			case "sitemap.aspx":
//				_Div = "ContentDiv";
//				_Href = "sitemap.aspx";
//				_CurrentMenu = "";
//				break;
//			case "careers.aspx":
//				_Div = "ContentDiv";
//				_Href = "careers.aspx";
//				_CurrentMenu = "";
//				break;
//			default:			    
//			    alert(filename);
//			    _Div = "HeaderContainerDiv";
//				_Href = "home-head.aspx";
//				document.getElementById('menuHome').bgColor="#C00000";
//				$("#headHome").attr({src : "images/menu/headHome.png"});
//				_CurrentMenu = "homeContent.aspx";
//				break;
//		};
//		if(!_ExitFlag)
//		{
//		$('<div id="loading" style="visibility:hidden">'+LoadMsg+'</div>').appendTo('body').fadeIn('slow',function(){
//			$('#LoadMsgDiv').css('visibility', 'visible');
//			$.ajax({
//				type:	'GET',
//				url:	'gn' + _Href,
//				dataType:	'html',
//				timeout:	15000,
//				success: function(d,s){
//						$('#loading').fadeOut('slow',function(){
//							$(this).remove();
//							$('#' + _Div).fadeOut('slow',function(){
//									$(this).html(d).slideDown('slow');
//								    $('#LoadMsgDiv').css('visibility', 'hidden');
//									if(_CurrentMenu == "Portfolio.aspx")
//									{
//										swapProductImg();
//									}
//									if(_Href == "desktopapplications.aspx")
//									{
//										swapDesktopImg();
//									}
//									if(_Href == "mobilewebsites.aspx")
//									{
//										swapMobileWebsiteImg();
//									}
//									if(_Href == "contactus.aspx")
//									{
//		                validateContactUs();
//		                swapContactUsImg();
//									}
//									if(_Href == "quote.aspx")
//									{
//									  validateQuote();
//										swapQuoteUsImg();
//									}
//									if(_Href == "webspace.aspx")
//									{
//									  validateWebspace();
//									}
//									if(_Href == "domain.aspx")
//									{
//									  validateDomain();
//									}
//									if(_Href == "counters.aspx")
//									{
//									  validateCounter();
//									}
//								});
//							});
//						},
//				error: function(o,s,e){
//							window.location = _Href;
//							if(_CurrentMenu == "Portfolio.aspx")
//							{
//								swapProductImg();
//							}
//							if(_Href == "mobilewebsites.aspx")
//							{
//								swapMobileWebsiteImg();
//							}
//							if(_Href == "contactus.aspx")
//							{
//								swapContactUsImg();
//								loadjs("javascripts/validation.js");
//							}
//							if(_Href == "quote.html")
//							{
//								swapQuoteUsImg();
//							}
//							if(_Href == "desktopapplications.aspx")
//							{
//								swapDesktopImg();
//							}
//						}
//			});
//		});
//		}
//        }
//		return false;
//	});
//});

function bg_highlight(id, color) {
if(document.all) {
thestyle = eval ('document.all.'+id+'.style');
thestyle.backgroundColor = color;
thestyle.cursor = hand;
}
}

function initApplication(currentMenu)
{
  _CurrentMenu = currentMenu;
	preloadImages();
	replaceImages();
	runTicker();
	MM_preloadImages('images/m1_1.png','images/m2_2.png','images/m3_3.png','images/m4_4.png','images/m5_5.png','images/m6_6.png','images/m7_7.png')
}

function replaceImages()
{
	$("#GNextHome").attr({src : "flash/GNextHome.jpg"});
	var bgColor = document.getElementById('menuPortfolio').bgColor;
	switch(_CurrentMenu)
	{
	  case "homeContent.aspx":      
	    $("#headHome").attr({src : "images/menu/headHome.png"});
	    $("#headServices").attr({src : "images/menu/headServices2.png"});
	    $("#headProjects").attr({src : "images/menu/headProjects2.png"});
	    $("#headHosting").attr({src : "images/menu/headHosting2.png"});
	    $("#headAboutUs").attr({src : "images/menu/headAboutUs2.png"});
      break;
    case "services.aspx":
	    $("#headHome").attr({src : "images/menu/headHome2.png"});
	    $("#headServices").attr({src : "images/menu/headServices.png"});
	    $("#headProjects").attr({src : "images/menu/headProjects2.png"});
	    $("#headHosting").attr({src : "images/menu/headHosting2.png"});
	    $("#headAboutUs").attr({src : "images/menu/headAboutUs2.png"});
	    break;
    case "Portfolio.aspx":
	    $("#headHome").attr({src : "images/menu/headHome2.png"});
	    $("#headServices").attr({src : "images/menu/headServices2.png"});
	    $("#headProjects").attr({src : "images/menu/headProjects.png"});
	    $("#headHosting").attr({src : "images/menu/headHosting2.png"});
	    $("#headAboutUs").attr({src : "images/menu/headAboutUs2.png"});
	    break;
    case "Hosting.aspx":
	    $("#headHome").attr({src : "images/menu/headHome2.png"});
	    $("#headServices").attr({src : "images/menu/headServices2.png"});
	    $("#headProjects").attr({src : "images/menu/headProjects2.png"});
	    $("#headHosting").attr({src : "images/menu/headHosting.png"});
	    $("#headAboutUs").attr({src : "images/menu/headAboutUs2.png"});
	    break;
    case "aboutus.aspx":
	    $("#headHome").attr({src : "images/menu/headHome2.png"});
	    $("#headServices").attr({src : "images/menu/headServices2.png"});
	    $("#headProjects").attr({src : "images/menu/headProjects2.png"});
	    $("#headHosting").attr({src : "images/menu/headHosting2.png"});
	    $("#headAboutUs").attr({src : "images/menu/headAboutUs.png"});
	    break;
	  default:
	    $("#headHome").attr({src : "images/menu/headHome2.png"});
	    $("#headServices").attr({src : "images/menu/headServices2.png"});
	    $("#headProjects").attr({src : "images/menu/headProjects2.png"});
	    $("#headHosting").attr({src : "images/menu/headHosting2.png"});
	    $("#headAboutUs").attr({src : "images/menu/headAboutUs2.png"});
	    break;
	}
}

function preloadImages()
{
	if (document.images)
	{
    imgPreload = new Image();

    ImageUrl = new Array();

    ImageUrl[0] = "images/menu/headHome2.png";        
    ImageUrl[1] = "images/menu/headServices.png";
    ImageUrl[2] = "images/menu/headProjects.png";
    ImageUrl[3] = "images/menu/headHosting.png";
    ImageUrl[4] = "images/menu/headAboutUs.png";

    ImageUrl[5] = "images/menu/headHome.png";
    ImageUrl[6] = "images/menu/headServices2.png";
    ImageUrl[7] = "images/menu/headProjects2.png";
    ImageUrl[8] = "images/menu/headHosting2.png";
    ImageUrl[9] = "images/menu/headAboutUs2.png";
   
    for(i = 0; i <= 10; i++)
    {
        imgPreload.src = ImageUrl[i];
    }
	}
}

function runTicker()
{
	var newnews = $("<ul>").attr("class", "infoTicker");
	newnews.append("<li>Complex Business Transforming Applications</li>");
	newnews.append("<li>Web Designing</li>");
	newnews.append("<li>Mobile Websites</li>");
	newnews.append("<li>Latest Technoligies: Asp .Net, C# .Net, VB .Net, PHP, Javascript, Ajax</li>");
	newnews.append("<li>Sql Server 2000, Sql Server 2005, MySql, Oracle, Access Databases</li>");
	newnews.append("<li>Search Engine Optimization</li>");
	newnews.append("<li>SEO Friendly Ajax</li>");
	newnews.append("<li>Security</li>");
	newnews.append("<li>Optimization: Bandwitdh Optimization, Least Server Load</li>");
	newnews.append("<li>Rich User Interface</li>");
	newnews.append("<li>In-Depth Testing of Applications</li>");
	newnews.append("<li>Version and Source Control of Applications</li>");
	newnews.append("<li>Offshore Web and Software Development</li>");
	newnews.append("<li>Enhancement</li>");
	newnews.appendTo("#mynews").newsTicker();
}

function swapImg(imgName)
{		
	switch(imgName)
	{
		case 'headHome':
			if(_CurrentMenu != 'homeContent.aspx') $("#headHome").attr({src : "images/menu/headHome.png"});
			break;
		case 'headHome2':	
			if(_CurrentMenu == 'homeContent.aspx') $("#headHome").attr({src : "images/menu/headHome.png"});
			else $("#headHome").attr({src : "images/menu/headHome2.png"});
			break;
		case 'headServices':
			if(_CurrentMenu != 'services.aspx') $("#headServices").attr({src : "images/menu/headServices.png"});
			break;
		case 'headServices2':	
			if(_CurrentMenu == 'services.aspx') $("#headServices").attr({src : "images/menu/headServices.png"});
			else $("#headServices").attr({src : "images/menu/headServices2.png"});
			break;
		case 'headProjects':
			if(_CurrentMenu != 'projects.html') $("#headProjects").attr({src : "images/menu/headProjects.png"});
			break;
		case 'headProjects2':	
			if(_CurrentMenu == 'Portfolio.aspx') $("#headProjects").attr({src : "images/menu/headProjects.png"});
			else $("#headProjects").attr({src : "images/menu/headProjects2.png"});
			break;
		case 'headHosting':
			if(_CurrentMenu != 'Hosting.aspx') $("#headHosting").attr({src : "images/menu/headHosting.png"});
			break;
		case 'headHosting2':	
			if(_CurrentMenu == 'Hosting.aspx') $("#headHosting").attr({src : "images/menu/headHosting.png"});
			else $("#headHosting").attr({src : "images/menu/headHosting2.png"});
			break;
		case 'headAboutUs':
			if(_CurrentMenu != 'aboutus.aspx') $("#headAboutUs").attr({src : "images/menu/headAboutUs.png"});
			break;
		case 'headAboutUs2':	
			if(_CurrentMenu == 'aboutus.aspx') $("#headAboutUs").attr({src : "images/menu/headAboutUs.png"});
			else $("#headAboutUs").attr({src : "images/menu/headAboutUs2.png"});
			break;
	}
}

function swapProductImg()
{		
	$("#PGNInventory").attr({src : "images/GNInventory.png"});
	$("#PGNEmbroidery").attr({src : "images/GNEmbroidery.png"});
	$("#PGNRoselle").attr({src : "images/GNRoselle.png"});
	$("#PGNSaket").attr({src : "images/GNSaket.png"});
}

function swapMobileWebsiteImg()
{		
	$("#mobileWebsite").attr({src : "images/MobileWebsite.png"});
}

function swapContactUsImg()
{		
	$("#ContactUs").attr({src : "images/contact-us.png"});
}

function swapQuoteUsImg()
{		
	$("#Quote").attr({src : "images/quote.png"});
}

function swapDesktopImg()
{		
	$("#Desktop").attr({src : "images/computers.jpg"});
}

function loadjs(filename){
  var fileref=document.createElement('script');
  fileref.setAttribute("type","text/javascript");
  fileref.setAttribute("src", filename);
  alert("Loaded..");
}

function clearForm()
{
  document.getElementById('contactusform').reset();
}

function GNextJs(page,div)
{
	var showApplication;
	if(window.XMLHttpRequest)
	{
		showApplication=new XMLHttpRequest;
	}
	else
	{
		showApplication=new ActiveXObject("Microsoft.XMLHTTP");
	}

	showApplication.open("GET",page,true);
	showApplication.onreadystatechange=function()
	{
		if(showApplication.readyState==4)
		{
			var xmlr=showApplication.responseText;
			document.getElementById(div).innerHTML=xmlr;
			if(page.substr(0,16) == "gncontactus.aspx")
			{
			  validateContactUs();
			}
			if(page.substr(0,15) == "gnwebspace.aspx")
			{
			  validateWebspace();
			}
			if(page.substr(0,13) == "gndomain.aspx")
			{
			  validateDomain();
			}
			if(page.substr(0,12) == "gnquote.aspx")
			{
			  validateQuote();
			}
			if(page.substr(0,15) == "gncounters.aspx")
			{
			  validateCounter();
			}
			if(page.substr(0,17) == "CheckCaptcha.aspx")
			{
        GNextJs("gncontactus.aspx?Name=" + document.getElementById("Name").value +
                                  "&Phone=" + document.getElementById("Phone").value +
                                  "&EMail=" + document.getElementById("EMail").value +
                                  "&Description=" + document.getElementById("Description").value,"HiddenDiv");
        GNextJs("gnthankyou.aspx","ContentDiv");
			}
			if(page.substr(0,26) == "CheckQuotationCaptcha.aspx")
			{
        GNextJs("gnquote.aspx?Name=" + document.getElementById("Name").value +
                              "&Company=" + document.getElementById("Company").value +
                              "&StreetAddress=" + document.getElementById("StreetAddress").value +
                              "&Landmark=" + document.getElementById("Landmark").value +
                              "&City=" + document.getElementById("City").value +
                              "&State=" + document.getElementById("State").value +
                              "&Country=" + document.getElementById("Country").value +
                              "&Phone=" + document.getElementById("Phone").value +
                              "&EMail=" + document.getElementById("EMail").value +
                              "&Description=" + document.getElementById("Description").value,"HiddenDiv");
        GNextJs("gnthankyou.aspx","ContentDiv");
			}
			if(page.substr(0,23) == "CheckDomainCaptcha.aspx")
			{
        GNextJs("gndomain.aspx?Name=" + document.getElementById("Name").value +
                              "&Company=" + document.getElementById("Company").value +
                              "&Phone=" + document.getElementById("Phone").value +
                              "&EMail=" + document.getElementById("EMail").value +
                              "&Description=" + document.getElementById("Description").value,"HiddenDiv");
        GNextJs("gnthankyou.aspx","ContentDiv");
			}
			if(page.substr(0,25) == "CheckWebspaceCaptcha.aspx")
			{
        GNextJs("gnwebspace.aspx?Name=" + document.getElementById("Name").value +
                              "&Company=" + document.getElementById("Company").value +
                              "&Phone=" + document.getElementById("Phone").value +
                              "&EMail=" + document.getElementById("EMail").value +
                              "&Description=" + document.getElementById("Description").value,"HiddenDiv");
        GNextJs("gnthankyou.aspx","ContentDiv");
			}
			if(page.substr(0,24) == "CheckCounterCaptcha.aspx")
			{
        GNextJs("gncounters.aspx?CompanyName=" + document.getElementById("CompanyName").value +
                              "&Password=" + document.getElementById("Password").value +
                              "&URL=" + document.getElementById("URL").value +
                              "&EMail=" + document.getElementById("EMail").value,"HiddenDiv");
        GNextJs("gncountercode.aspx","ContentDiv");
			}
		}
	};
	showApplication.send(null);
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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];}
}