

/* Header Signup Functions */
function submitEmail(frm) {
  eml = frm.temail.value;
  atIndex = eml.indexOf('@');
  dotIndex = eml.indexOf('.', atIndex);
  if(atIndex < dotIndex) {
    frm.EMAIL.value = eml;
    frm.temail.value = '';
    openPopupWindow('', 450, 265, 'no', 'emlRegWin');
    return true;
  } else {
    alert("Please enter a valid email address");
    return false;
  }
}

function removeMsg(el, msg) {
  if(el.value == msg)
    el.value = '';
}

function changeColor(color, ID) {
		document.getElementById(ID).bgColor = "#" + color;
	}
/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/

function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

window.onload = initRollovers;
//----------------------------------------------------------------------------------------//
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 ID1")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID2")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID3")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID4")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID5")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID6")
		    return false
		 }
         
         
 		 return true					
	}

function validateForm(){
          

	var emailID=document.frmsample.email.value;
	if((emailID==null)||(emailID=="")){
		alert(" Please Enter your Email ID7")
		emailID.focus()
		return false
	}
	
	if (echeck(emailID)==false){
		emailID=""
		//document.frmsample.email.focus()
		
		return false
	}
	
	
	document.frmsample.method="post";
	document.frmsample.action="../main/secondb.asp";
	document.frmsample.submit();
		
	return true
	

 }

function validateFormd(){
//alert("HAI")
          /*var name=document.sent.name.value;
          if(name==" ")
          alert("enter user name");*/
	        
	var emailID=document.sent.email.value;
	var name1=document.sent.name.value;
	var productid=document.sent.productId.value;
	
//	if(name==" ")
	 //      {
	  ////        alert("enter user name");
	  //       }
	  //        else
	  //        {
	if((emailID==null)||(emailID=="")){
		alert("Please Enter your Email ID")
		document.sent.email.focus()
		return false
	}
	
	if (echeck(emailID)==false){
		emailID=""
		emailID.focus()
		
		return false
	}
	
	document.sent.action="../main/insertvalueintotable.asp";
         document.sent.method="post"
         document.sent.submit();
	
	return true
	 }



/* Free Trial */


   
function validateFormFreeTrial(){

	var emailID=document.sent.email.value;
	var name1=document.sent.name.value;

              if(( name1==null)||( name1=="")){
		alert("Please Enter your name")
		
		return false
	}

	if((emailID==null)||(emailID=="")){
		alert("Please Enter your Email ID")
		document.sent.email.focus()
		return false
	}
	

	if (echeck(emailID)==false){
		emailID=""
		emailID.focus()
		
		return false
	}
	document.sent.method="post"

	document.sent.action="../Powerpoint/Powerpoint-flash-free-license-submit.asp";
         
         document.sent.submit();
	
	return true
	 }


  
 
	
/* livesupport Functions */

var serverURL; //with proxy
var clientURL; 
var vendorID;
var contractId;
var contractOrderId;
var productId;
var requesterOperatorId;
var origUrl;
var onlineImagePath  = "../images/live_assistance.gif";
var offlineImagePath = "../images/live_assistance_offline.gif";
var userBrowser = "other";
var target;
var productId;
function setLiveAssistanceParameters(_serverURL, _clientURL, _vendorID, _contractId, _contractOrderId, _productId, _origUrl, _onlineImagePath, _offlineImagePath){

	// Initializing variables
	serverURL 		= _serverURL;
	clientURL 		= _clientURL;
	vendorID		= _vendorID ;
	contractId		= _contractId;
	contractOrderId 	= _contractOrderId;
        productId               = _productId;
	origUrl          	= _origUrl;
	requesterOperatorId	= -99;
	
	if( _onlineImagePath != null && _onlineImagePath != "" && onlineImagePath != "none"){
		onlineImagePath = _onlineImagePath;
	}
        else{
            onlineImagePath = "";
        }
	
	if( _offlineImagePath != null && _offlineImagePath != "" && offlineImagePath != "none"){
		offlineImagePath = _offlineImagePath;
	}
        else{
            offlineImagePath = "";
        }
	
}//End of function initRequest
function openLoginChat( )
{

	var extraDetails = getExtraInfo();

        /*
	var windowName = "LiveAssistance_" + vendorID ;
	if( vendorID < 0 ){
		windowName = "LiveAssistance_Plimus" ;
	}//End if
        */
        var windowName = "_blank";
 
	window.open( 	clientURL + "userchat?action=login&vendor=" + vendorID + "&url=" + origUrl + "&clientpath=" + clientURL + "&contractId=" + contractId + "&contractOrderId=" + contractOrderId + 
                    "&productId=" + productId + "&requesterOperatorId=" + requesterOperatorId + extraDetails , windowName , "toolbar=no,location=no,directories=no,status=no,menubar=no,titlebar=no,resizable=yes,width=480,height=350,left=200,top=200" );
}//End of function openLoginChat
//----------------------------------------------------------------------------------------------
function getExtraInfo( ) {
	
	var firstName 	= "";
	var lastName 	= "";
	var email       = "";
	
	//Trying to retrieve the parameters because they are not for certain on the screen
	try{
		//var firstName 	= eval( "document.forms[0].firstName.value" );
		//var email 		= eval( "document.forms[0].email.value" );
		//var lastName 	= eval( "document.forms[0].lastName.value" );
		
	}catch( e ){
		 ;
	}//End Try..Catch
	
	var extraDetails = "";
	if( firstName > "" || firstName > "" ){
		extraDetails += "&username=" + firstName + "+" + lastName ;
	}//End if
	
	if( email > ""  ){
		extraDetails += "&email=" + email ;
	}//End if

	return ( extraDetails );
	
}//End of function getExtraInfo
//----------------------------------------------------------------------------------------------

function Image1_onclick() 
{
setLiveAssistanceParameters( "https://digitalofficepro.plimus.com/laproxy?http://liveassistance.plimus.com/laserver/" , "http://liveassistance.plimus.com/la/" , "81942" , 1705804 , -99 , 67292 , "digitalofficepro.plimus.com/jsp/buynow.jsp" , "https://digitalofficepro.plimus.com/images/live_assistance.gif" , "https://digitalofficepro.plimus.com/images/live_assistance_offline.gif"  ); 
   openLoginChat( );
   //window.open("http://www.google.com","google","toolbar=no,location=no");
}
