/**
	* @author			:	Swapnil Bedekar <swapnil@nyasasoftec.com>
	* @version			:	1.0
	* @access				:	private to nyasasoftec pvt. ltd.
	* @copyright		:	Copyright (c) 2007 nyasasoftec pvt. ltd.
									http://www.nyasasoftec.com
	* @File Name		:	ds.js. This page used to store rutine javascript function.
*/

function time_get() {
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds()
	document.add_data1.time.value =hours+":"+minutes+":"+seconds;
}

function time_get1() {
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds()
	document.add_data.time.value =hours+":"+minutes+":"+seconds;
}

function time_hr() {
	var now = new Date();
	var hours = now.getHours();
	return hours;
}

function addDate(date, cssclass, cssstyle)
{
	var ds;
	if(''==cssclass)cssclass='';
	if(''==cssstyle)cssstyle='';
	var mna = new Array(13);
	mna[0]  = "January";
	mna[1]  = "February";
	mna[2]  = "March";
	mna[3]  = "April";
	mna[4]  = "May";
	mna[5]  = "June";
	mna[6]  = "July";
	mna[7]  = "August";
	mna[8]  = "September";
	mna[9]  = "October";
	mna[10] = "November";
	mna[11] = "December";
	var dt = new Date();
	var y, m, mn, d;

	if(''==date || 'undefined' == typeof(date))
		{

			var dt = new Date();
			y = dt.getYear()
			m = dt.getMonth();
			//m = dt.getMonth()+1;
			mn   = mna[m];
			if (10>++m)m="0"+m;
			d = dt.getDate();
			if (10>d)d="0"+d;
		}
		else
		{
			var str = new Array();
			str = date.split('/');
			y = str[0];
			m=str[1];
			d=str[2];
			mn   = mna[--str[1]];
		}
			ds = mn + ' ' + d + ', ' + y;
			date =   m + '-' + d + '-' + y;

 	document.write("<input type='hidden' name='jDate'  value='" + date + "'>");
//	document.write("<span style='"+cssstyle+"' class='" + cssclass + "'>"+ds+"</span>");
	return date;

}

var datePickerDivID = "datepicker";
var iFrameDivID = "datepickeriframe";

var dayArrayShort = new Array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa');
var dayArrayMed = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
var dayArrayLong = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
var monthArrayShort = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
var monthArrayMed = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec');
var monthArrayLong = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
 
// these variables define the date formatting we're expecting and outputting.
// If you want to use a different format by default, change the defaultDateSeparator
// and defaultDateFormat variables either here or on your HTML page.
var defaultDateSeparator = "/";        // common values would be "/" or "."
var defaultDateFormat = "mdy"    // valid values are "mdy", "dmy", and "ymd"
var dateSeparator = defaultDateSeparator;
var dateFormat = defaultDateFormat;

/////////function////////////////////
function displayDatePicker(dateFieldName, displayBelowThisObject, dtFormat, dtSep)
{
  var targetDateField = document.getElementsByName (dateFieldName).item(0);
	
  // if we weren't told what node to display the datepicker beneath, just display it
  // beneath the date field we're updating
  if (!displayBelowThisObject)
	{
		displayBelowThisObject = targetDateField;
		//alert(displayBelowThisObject.name
	}
		displayBelowThisObject = targetDateField;

  // if a date separator character was given, update the dateSeparator variable
  if (dtSep)
    dateSeparator = dtSep;
  else
    dateSeparator = " ";
 
  // if a date format was given, update the dateFormat variable
  if (dtFormat)
    dateFormat = dtFormat;
  else
    dateFormat = defaultDateFormat;

  var x = displayBelowThisObject.offsetLeft;
  var y = displayBelowThisObject.offsetTop + displayBelowThisObject.offsetHeight ;
 
  // deal with elements inside tables and such
  var parent = displayBelowThisObject;
  while (parent.offsetParent) {
    parent = parent.offsetParent;
    x += parent.offsetLeft;
    y += parent.offsetTop ;
  }
 
  drawDatePicker(targetDateField, x, y);

}


////////////////////draw function////////////
function drawDatePicker(targetDateField, x, y) {
	var dt = getFieldDate(targetDateField.value );
	// the datepicker table will be drawn inside of a <div> with an ID defined by the
	// global datePickerDivID variable. If such a div doesn't yet exist on the HTML
	// document we're working with, add one.
	if (!getObject(datePickerDivID)) {
		// don't use innerHTML to update the body, because it can cause global variables
		// that are currently pointing to objects on the page to have bad references
		//document.body.innerHTML += "<div id='" + datePickerDivID + "' class='dpDiv'></div>";
		var newNode = document.createElement("div");
		newNode.setAttribute("id", datePickerDivID);
		newNode.setAttribute("class", "dpDiv");
		newNode.setAttribute("style", "visibility: hidden;");
		document.body.appendChild(newNode);
	}
	// alert(x);
	// alert(y);
	// move the datepicker div to the proper x,y coordinate and toggle the visiblity
	var pickerDiv = getObject(datePickerDivID);
	pickerDiv.style.position = "absolute";
	pickerDiv.style.left = x + "px";
	pickerDiv.style.top = y + "px";
	pickerDiv.style.visibility = (pickerDiv.style.visibility == "visible" ? "hidden" : "visible");
	pickerDiv.style.display = (pickerDiv.style.display == "block" ? "none" : "block");
	pickerDiv.style.zIndex = 10000;

	// draw the datepicker table
	refreshDatePicker(targetDateField.name, dt.getFullYear(), dt.getMonth(), dt.getDate());
}

function refreshDatePicker(dateFieldName, year, month, day)
{
  // if no arguments are passed, use today's date; otherwise, month and year
  // are required (if a day is passed, it will be highlighted later)
  var thisDay = new Date();
 
  if ((month >= 0) && (year > 0)) {
    thisDay = new Date(year, month, 1);
  } else {
    day = thisDay.getDate();
    thisDay.setDate(1);
  }
 
  // the calendar will be drawn as a table
  // you can customize the table elements with a global CSS style sheet,
  // or by hardcoding style and formatting elements below
  var crlf = "\r\n";
  var TABLE = "<table cols=7 class='dpTable'>" + crlf;
  var xTABLE = "</table>" + crlf;
  var TR = "<tr class='dpTR'>";
  var TR_title = "<tr class='dpTitleTR'>";
  var TR_days = "<tr class='dpDayTR'>";
  var TR_todaybutton = "<tr class='dpTodayButtonTR'>";
  var xTR = "</tr>" + crlf;
  var TD = "<td class='dpTD' onMouseOut='this.className=\"dpTD\";' onMouseOver=' this.className=\"dpTDHover\";' ";    // leave this tag open, because we'll be adding an onClick event
  var TD_title = "<td colspan=5 class='dpTitleTD'>";
  var TD_buttons = "<td class='dpButtonTD'>";
  var TD_todaybutton = "<td colspan=7 class='dpTodayButtonTD'>";
  var TD_days = "<td class='dpDayTD'>";
  var TD_selected = "<td class='dpDayHighlightTD' onMouseOut='this.className=\"dpDayHighlightTD\";' onMouseOver='this.className=\"dpTDHover\";' ";    // leave this tag open, because we'll be adding an onClick event
  var xTD = "</td>" + crlf;
  var DIV_title = "<div class='dpTitleText'>";
  var DIV_selected = "<div class='dpDayHighlight'>";
  var xDIV = "</div>";
 
  // start generating the code for the calendar table
  var html = TABLE;
 
  // this is the title bar, which displays the month and the buttons to
  // go back to a previous month or forward to the next month
  html += TR_title;
  html += TD_buttons + getButtonCode(dateFieldName, thisDay, -1, "&lt;") + xTD;
  html += TD_title + DIV_title + monthArrayLong[ thisDay.getMonth()] + " " + thisDay.getFullYear() + xDIV + xTD;
  html += TD_buttons + getButtonCode(dateFieldName, thisDay, 1, "&gt;") + xTD;
  html += xTR;
 
  // this is the row that indicates which day of the week we're on
  html += TR_days;
  for(i = 0; i < dayArrayShort.length; i++)
    html += TD_days + dayArrayShort[i] + xTD;
  html += xTR;
 
  // now we'll start populating the table with days of the month
  html += TR;
 
  // first, the leading blanks
  for (i = 0; i < thisDay.getDay(); i++)
    html += TD + "&nbsp;" + xTD;
 
  // now, the days of the month
  do {
    dayNum = thisDay.getDate();
    TD_onclick = " onclick=\"updateDateField('" + dateFieldName + "', '" + getDateString(thisDay) + "');\">";
    
    if (dayNum == day)
      html += TD_selected + TD_onclick + DIV_selected + dayNum + xDIV + xTD;
    else
      html += TD + TD_onclick + dayNum + xTD;
    
    // if this is a Saturday, start a new row
    if (thisDay.getDay() == 6)
      html += xTR + TR;
    
    // increment the day
    thisDay.setDate(thisDay.getDate() + 1);
  } while (thisDay.getDate() > 1)
 
  // fill in any trailing blanks
  if (thisDay.getDay() > 0) {
    for (i = 6; i > thisDay.getDay(); i--)
      html += TD + "&nbsp;" + xTD;
  }
  html += xTR;
 
  // add a button to allow the user to easily return to today, or close the calendar
  var today = new Date();
  var todayString = "Today is " + dayArrayMed[today.getDay()] + ", " + monthArrayMed[ today.getMonth()] + " " + today.getDate();
  html += TR_todaybutton + TD_todaybutton;
  html += "<button class='dpTodayButton' onClick='refreshDatePicker(\"" + dateFieldName + "\");'>this month</button> ";
  html += "<button class='dpTodayButton' onClick='updateDateField(\"" + dateFieldName + "\");'>close</button>";
  html += xTD + xTR;
 
  // and finally, close the table
  html += xTABLE;
 
  getObject(datePickerDivID).innerHTML = html;
  // add an "iFrame shim" to allow the datepicker to display above selection lists
  adjustiFrame();
}

function getButtonCode(dateFieldName, dateVal, adjust, label)
{
  var newMonth = (dateVal.getMonth () + adjust) % 12;
  var newYear = dateVal.getFullYear() + parseInt((dateVal.getMonth() + adjust) / 12);
  if (newMonth < 0) {
    newMonth += 12;
    newYear += -1;
  }
 
  return "<button class='dpButton' onClick='refreshDatePicker(\"" + dateFieldName + "\", " + newYear + ", " + newMonth + ");'>" + label + "</button>";
}

function getDateString(dateVal) {
	var dayString = "00" + dateVal.getDate();
	var monthString = "00" + (dateVal.getMonth()+1);
	dayString = dayString.substring(dayString.length - 2);
	monthString = monthString.substring(monthString.length - 2);

	switch (dateFormat) {
		case "dmy" :
			return dayString + dateSeparator + monthString + dateSeparator + dateVal.getFullYear();
		case "ymd" :
			return dateVal.getFullYear() + dateSeparator + monthString + dateSeparator + dayString;
		case "mdy" :
		default :	return monthString + dateSeparator + dayString + dateSeparator + dateVal.getFullYear();
	}
}

function getFieldDate(dateString)
{
  var dateVal;
  var dArray;
  var d, m, y;
 
  try {
    dArray = splitDateString(dateString);
    if (dArray) {
      switch (dateFormat) {
        case "dmy" :
          d = parseInt(dArray[0], 10);
          m = parseInt(dArray[1], 10) - 1;
          y = parseInt(dArray[2], 10);
          break;
        case "ymd" :
          d = parseInt(dArray[2], 10);
          m = parseInt(dArray[1], 10) - 1;
          y = parseInt(dArray[0], 10);
          break;
        case "mdy" :
        default :
          d = parseInt(dArray[1], 10);
          m = parseInt(dArray[0], 10) - 1;
          y = parseInt(dArray[2], 10);
          break;
      }
      dateVal = new Date(y, m, d);
    } else if (dateString) {
      dateVal = new Date(dateString);
    } else {
      dateVal = new Date();
    }
  } catch(e) {
    dateVal = new Date();
  } 
  return dateVal;
}

function splitDateString(dateString)
{
  var dArray;
  if (dateString.indexOf("/") >= 0)
    dArray = dateString.split("/");
  else if (dateString.indexOf(".") >= 0)
    dArray = dateString.split(".");
  else if (dateString.indexOf("-") >= 0)
    dArray = dateString.split("-");
  else if (dateString.indexOf("\\") >= 0)
    dArray = dateString.split("\\");
  else
    dArray = false;

  return dArray;
}
function datePickerClosed(dateField)
{
  var dateObj = getFieldDate(dateField.value);
  var today = new Date();
  today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
 
  if (dateField.name == "StartDate") {
    if (dateObj < today) {
      // if the date is before today, alert the user and display the datepicker again
      alert("Please enter a date that is today or later");
      dateField.value = "";
      getObject(datePickerDivID).style.visibility = "visible";
      adjustiFrame();
    } else {
      // if the date is okay, set the EndDate field to 7 days after the StartDate
      dateObj.setTime(dateObj.getTime() + (7 * 24 * 60 * 60 * 1000));
      var endDateField = document.getElementsByName ("EndDate").item(0);
      endDateField.value = getDateString(dateObj);
    }
  }
}

function updateDateField(dateFieldName, dateString)
{
  var targetDateField = document.getElementsByName (dateFieldName).item(0);
  if (dateString)
    targetDateField.value = dateString;
 
  var pickerDiv = getObject(datePickerDivID);
  pickerDiv.style.visibility = "hidden";
  pickerDiv.style.display = "none";
 
  adjustiFrame();
  targetDateField.focus();
 
  // after the datepicker has closed, optionally run a user-defined function called
  // datePickerClosed, passing the field that was just updated as a parameter
  // (note that this will only run if the user actually selected a date from the datepicker)
  if ((dateString) && (typeof(datePickerClosed) == "function"))
    datePickerClosed(targetDateField);
}

function adjustiFrame(pickerDiv, iFrameDiv)
{
  // we know that Opera doesn't like something about this, so if we
  // think we're using Opera, don't even try
  var is_opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
  if (is_opera)
    return;
  
  // put a try/catch block around the whole thing, just in case
  try {
    if (!getObject(iFrameDivID)) {
      // don't use innerHTML to update the body, because it can cause global variables
      // that are currently pointing to objects on the page to have bad references
      //document.body.innerHTML += "<iframe id='" + iFrameDivID + "' src='javascript:false;' scrolling='no' frameborder='0'>";
      var newNode = document.createElement("iFrame");
      newNode.setAttribute("id", iFrameDivID);
      newNode.setAttribute("src", "javascript:false;");
      newNode.setAttribute("scrolling", "no");
      newNode.setAttribute ("frameborder", "0");
      document.body.appendChild(newNode);
    }
    
    if (!pickerDiv)
      pickerDiv = getObject(datePickerDivID);
    if (!iFrameDiv)
      iFrameDiv = getObject(iFrameDivID);
    
    try {
      iFrameDiv.style.position = "absolute";
      iFrameDiv.style.width = pickerDiv.offsetWidth;
      iFrameDiv.style.height = pickerDiv.offsetHeight ;
      iFrameDiv.style.top = pickerDiv.style.top;
      iFrameDiv.style.left = pickerDiv.style.left;
      iFrameDiv.style.zIndex = pickerDiv.style.zIndex - 1;
      iFrameDiv.style.visibility = pickerDiv.style.visibility ;
      iFrameDiv.style.display = pickerDiv.style.display;
    } catch(e) {
    }
 
  } catch (ee) {
  }
 
}

var timerID = null;
var timerRunning = false;

function stopclock () {
	if(timerRunning)
		clearTimeout(timerID);
	timerRunning = false;
}

function showtime ()  {
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds()
	var timeValue = "" + ((hours >12) ? hours -12 :hours)
	if (timeValue == "0") timeValue = 12;
	timeValue += ((minutes < 10) ? ":0" : ":") + minutes
	timeValue += ((seconds < 10) ? ":0" : ":") + seconds
	document.add_data.time.value = timeValue;
	 
	timerID = setTimeout("showtime()",1000);
	timerRunning = true;
}

function startclock() {
	stopclock();
	showtime();
}

function menu(which,counter) {
  flag = true;
  if(getObject("divSub"+which).style.display == "") flag = false;
  for(i = 0;i<counter;i++)
  {
    //'divSub';
    getObject("divSub"+i).style.display = "none";
    imgtmp = eval("document.imgA"+i);
    imgtmp.src = "images/foldoutmenu_arrow.gif";
  }

  if(flag)
  {
    getObject("divSub"+which).style.display = "";
    imgtmp = eval("document.imgA"+which);
    imgtmp.src = "images/foldoutmenu_arrow_open.gif";
  }

  //imgA
  //foldoutmenu_arrow_open.gif
  return false;
}

function chk_validate1() {
	d=document.frmsearch1;
	if(d.txtemail.value=="") {
		alert("Please Enter E-Mail");
		d.txtemail.focus();
		return false;
	}

	if(d.txtpwd.value=="") {
		alert("Please Password");
		d.txtpwd.focus();
		return false;
	}
}

/* End*/

/* Modified by: Vaibav Dalvi
Date:22-12-20078
This  js modified  for  all product  link on top  for  Alphabetical  select change color of that div  page
*/

var current_cat='0';
function FocusOnMe(to_me) {
	getObject("Category_td_"+to_me).className='SelectedCategoryHead';
	getObject("Category_"+to_me).className='SelectedCategoryDiv';	 	
	getObject("Category_td_"+to_me).focus();
	if(current_cat!='0') {
		getObject("Category_td_"+current_cat).className='DefaultCategoryHead';
		getObject("Category_"+current_cat).className='DefaultCategoryDiv';	 
	}
	current_cat=to_me;
}
/*End*/

/* Modified by: Vaibav Dalvi
Date:26-12-20078
This function is for  redio button validation And  check the value
*/

function RadioButtonValidation(Value){
	d= document.FrmProductSearch;

	if (Value==1) {
	    d.AlphabaticalSearch.disabled=false;
	    d.AlphabaticalSearch.className="ClsEnable";
	    d.ProductBrandName.disabled=true;
	    d.ProductBrandName.value="";
	    d.ProductBrandName.className="ClsDisable";
	    d.ProductGenericName.disabled=true;
	    d.ProductGenericName.value="";
	    d.ProductGenericName.className="ClsDisable";
	}

	if (Value==2) {
	    d.AlphabaticalSearch.disabled=true;
	    d.AlphabaticalSearch.options.selectedIndex=0;
	    d.AlphabaticalSearch.className="ClsDisable";
	    d.ProductBrandName.disabled=false;
	    d.ProductBrandName.className="ClsEnable";
	    d.ProductGenericName.disabled=true;
	    d.ProductGenericName.value="";
	    d.ProductGenericName.className="ClsDisable";
	}

	if (Value==3) {
	    d.AlphabaticalSearch.disabled=true;
	    d.AlphabaticalSearch.options.selectedIndex=0;
	    d.AlphabaticalSearch.className="ClsDisable";
	    d.ProductBrandName.disabled=true;
	    d.ProductBrandName.value="";
	    d.ProductBrandName.className="ClsDisable";
	    d.ProductGenericName.disabled=false;
	    d.ProductGenericName.className="ClsEnable";
	}

	if (Value==4) {
	    d.AlphabaticalSearch.disabled=true;
	    d.AlphabaticalSearch.options.selectedIndex=0;
	    d.AlphabaticalSearch.className="ClsDisable";
	    d.ProductBrandName.disabled=true;
	    d.ProductBrandName.value="";
	    d.ProductBrandName.className="ClsDisable";
	    d.ProductGenericName.disabled=true;
	    d.ProductGenericName.value="";
	    d.ProductGenericName.className="ClsDisable";
	}
}

function SubmitCategorySearch(url) {
	document.AdvanceSearchBox.action="http://www.tristatedrugs.com/"+url;
	document.AdvanceSearchBox.submit();
}

function GetFinalAmout(price, value) {
	VarPrice = parseFloat(price);
	
	ValueArr = value.split("_");
	ShippingPrice = parseFloat(ValueArr[1]);

	FinalTotal = VarPrice  + ShippingPrice;

// If Handling Price Exist
	if (getObject('HandlingPrice').value) { 
		FinalTotal = FinalTotal + parseFloat(getObject('HandlingPrice').value);
		getObject('HiddenHandling').style.display="";
	}

	getObject('HiddenTotal').style.display="";

	getObject('TotalPrice').value=FinalTotal;

	FinalTotal = getObject('TotalPrice').value;

	if(FinalTotal.indexOf('.') > 0) {
		DotPosition = FinalTotal.indexOf('.');
		TwoSpacesAfterDot = eval(DotPosition + 1);
		FinalTotal1 = FinalTotal.substr(0, DotPosition);
		FinalTotal2 = FinalTotal.substr(TwoSpacesAfterDot, 2);
		FinalTotal = FinalTotal1 + "." + FinalTotal2;
	}

	getObject('FinalTotalPrice').innerHTML=FinalTotal;
	getObject('TotalPrice').value=FinalTotal;
}


function ShowHide() {
	if (getObject("ShippingTable").style.display=="none")
		getObject("ShippingTable").style.display="";
	else {
		getObject("Scountry").options.selectedIndex=0;
		getObject("ShippingTable").style.display="none";
		getObject('HiddenHandling').style.display="none";
		getObject('HiddenTotal').style.display="none";
		getObject('ShippingMode').innerHTML="";
	}
}

//Check Validation for  Delete product from My cart
function DeleteProduct(IdDelete) {
	GetConfirm=confirm("Are you sure you want to DELETE");
	
	if(GetConfirm)
		location.href="deleteitem.php?IdDelete=" + IdDelete;
}

function ShowShipping(value) {
	location.href="mycart.php?StoreCountryArea=" + value;
}

function SelectCountry(url) {
	d = document.OrderDetails;

	if (d.StoreCountry.options.selectedIndex!=0) {
		d.action=url;
		d.submit();
	}
	else
		alert ("Please Select the Shipping Country");
}


function CalculateShipping(ValsArr) {
	d = document.OrderDetails;

	var SpiltValsArr;
	SpiltValsArr = ValsArr.split("--");

	if(d.SubTotalPrice.value!="")
		d.FinalAmount.value = parseFloat(d.SubTotalPrice.value) + parseFloat(SpiltValsArr[0]);

	if(d.Handling.value!="")
		d.FinalAmount.value = parseFloat(d.FinalAmount.value) + parseFloat(d.Handling.value);

	TxtFinalAmount = d.FinalAmount.value;

	if(TxtFinalAmount.indexOf('.') > 0) {
		pos = TxtFinalAmount.indexOf('.');
		pos1 = eval(pos+1);
		TxtFinalAmount1 = TxtFinalAmount.substr(0,pos);
		TxtFinalAmount2 = TxtFinalAmount.substr(pos1,2);
		TxtFinalAmount = TxtFinalAmount1 +"."+ TxtFinalAmount2;
	}
	else
		TxtFinalAmount = d.FinalAmount.value + ".00";

	d.FinalAmount.value = TxtFinalAmount;
	getObject("SpanFinalTotal").innerHTML = TxtFinalAmount;
}

function ValidateCart() {
	d = document.OrderDetails;

	if (d.StoreCountry.options.selectedIndex==0) {
		alert("Please, Select the Shipping Country");
		return false;
	}
}

function RemoveDiv(Middlepage, AjaxMiddleDiv, ShoppingCartItem, AjaxShoppingCartItemDiv, RightSideDiv, RemoveMainDiv, RemoveRegistrationDiv) {
		makeRequest(Middlepage, '', AjaxMiddleDiv, 'post', '');
//	makeRequest(ShoppingCartItem, '', AjaxShoppingCartItemDiv, 'post', '');

	MainDivObject=getObject(RemoveMainDiv);
	MainDivObject.style.display="none";

	RegistrationDivObject=getObject(RemoveRegistrationDiv);
	RegistrationDivObject.innerHTML="";
	RegistrationDivObject.style.display="none";

	RightSideObject=getObject(RightSideDiv);
	RightSideObject.style.display="block";
	RightSideObject.style.visibility="visible";
}


function ValidateShortShipping() {
	d = document.FrmOrderSummery;

	if (d.Scountry.value=="0") {
		alert ("No Shipping Country and Shipping Mode is Selected. Please, Select Shipping Country and Mode");
		return false;
	}
	else {
		if (d.ShipCountry) {
			var cnt = -1;
			var radiobut = d.ShipCountry;
	
			for (var i=0; i < radiobut.length; i++) {
				if (radiobut[i].checked) // If Any Radio button is checked by User
					cnt = i; 
			}
	
			if (cnt == -1) {
				alert ("No Shipping Mode Selected. Please, Select atleast one Shipping Mode");
				return false;
			}
			else 
				return true;
		}
	}
}

function ConfirmDelete(url, successfunc, uiElement, method, params) {
	if(confirm("Do you want to remove this product from your cart ?"))
		makeRequest(url, successfunc, uiElement, method, params);
}


function getCookie(NameOfCookie) {
	if (document.cookie.length > 0) {
		begin = document.cookie.indexOf(NameOfCookie+"=");       
		if (begin != -1) {
			begin += NameOfCookie.length+1;       
			end = document.cookie.indexOf(";", begin);
			
			if (end == -1) end = document.cookie.length;
				return unescape(document.cookie.substring(begin, end));
		} 
	}
}

function getsequrity(url) {
	Frm=document.Frmforgetpass;

	if (getObject('ForgetPasswordEmailId').value=="") {
		alert("Please, Enter your valid Email Address");
		getObject('ForgetPasswordEmailId').focus();
		return false;
	}

	if (checkEmail(getObject('ForgetPasswordEmailId').value)) {
		alert("Please, Enter your valid Email Address");
		getObject('ForgetPasswordEmailId').focus();
		return false;
	} 

	pars="UserEmail=" + getObject('ForgetPasswordEmailId').value;
	makeRequest(url + 'getforgetpwddet.php', 'GetSecurityDetails', "ForgetPassword", 'post', pars);
}


function RevertDetails() {
	Frm=document.Frmforgetpass;
    getObject("ForgetPassword").innerHTML="&nbsp;";
	getObject('ForgetPasswordEmailId').value="";
	getObject('ForgetPasswordEmailId').disabled=false;
	getObject('btn_forget').disabled=true;
	getObject('ChangeEmail').style.display="none";
}

function ValidateFogetPass(Frm) {
	if (Frm.btn_forget.disabled==false) {
		if (Frm.UserEmail.value=="") {
			alert("Registred Email Id must not be Blank");
			Frm.UserEmail.focus();
			return false;
		}

		if (Frm.UserSecurityAnswer.value=="") {
			alert("Secured Hint must not be blank");
			Frm.UserSecurityAnswer.focus();
			return false;
		}
	}
	else 
		return false;
}

function ShowHideAnswer(val) {
	for (i=1; i<=21; i++) {
		if (getObject("div" + i)) {
			if (i==val) {
				if (getObject("div" + val).style.display=="none")
					getObject("div" + val).style.display="";
				else
					getObject("div" + val).style.display="none";
			}
			else
				getObject("div" + i).style.display="none";
		}
	}
} 

function DisplayDiv(reqddiv)  {
	if (getObject(reqddiv).style.display=="none")
		getObject(reqddiv).style.display="";
	else
		getObject(reqddiv).style.display="none";
}

function ShowAllPreviousOrder(TotalOrders) {
	for(i=1; i<=TotalOrders; i++) {
		if (getObject('PreviousOrder_' + i).style.display=="none")
			getObject('PreviousOrder_' + i).style.display="";
		else
			getObject('PreviousOrder_' + i).style.display="none";
	}
}

function popup(url) {
	mywindow = window.open (url,"mywindow","location=0,status=0,scrollbars=1,width=300,height=250,directory=0,left=120,top=120");
}

function RedirectToPage(Page) {
	location.href=Page;
}

function changeMyStyle(ths) {
	ths.style.border="1px dotted red";
}

function changeMyStyleBack(ths) {
	ths.style.border="1px dotted #ccc";
}

function pausescroller(content, divId, divClass, delay)
	{
	this.content=content //message array content
	this.tickerid=divId //ID of ticker div to display information
	this.delay=delay //Delay between msg change, in miliseconds.
	this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
	this.hiddendivpointer=1 //index of message array for hidden div
	document.write('<div class="OrangeMiddle"><div class="testimonial">Testimonial</div></div><div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden; text-align:center; width:224px; left:0px;"><div style="position: absolute; width:200px; text-align:left; padding-left:2px;" id="'+divId+'1">'+content[0]+'</div><div style=" visibility: hidden; position: absolute; width:200px; text-align:left; padding-left:2px;" id="'+divId+'2">'+content[1]+'</div></div><div class="YellowTableBotTestimon"></div>')
	var scrollerinstance=this
		if (window.addEventListener) //run onload in DOM2 browsers
			window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
		else if (window.attachEvent) //run onload in IE5.5+
			window.attachEvent("onload", function(){scrollerinstance.initialize()})
		else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
			setTimeout(function(){scrollerinstance.initialize()}, 500)
		}
//style="background-color:#4B3C03;border-left:1px solid #434343;border-right:1px solid #434343;width:100%;height:30px;font-size:14px;"
	// -------------------------------------------------------------------
	// initialize()- Initialize scroller method.
	// -Get div objects, set initial positions, start up down animation
	// -------------------------------------------------------------------
	pausescroller.prototype.initialize=function()
	{
	this.tickerdiv=document.getElementById(this.tickerid)
	this.visiblediv=document.getElementById(this.tickerid+"1")
	this.hiddendiv=document.getElementById(this.tickerid+"2")
	this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
	//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
	this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
	this.getinline(this.visiblediv, this.hiddendiv)
	this.hiddendiv.style.visibility="visible"
	var scrollerinstance=this
	document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
	document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
	if (window.attachEvent) //Clean up loose references in IE
		window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
	setTimeout(function(){scrollerinstance.animateup()}, this.delay)
	}


	// -------------------------------------------------------------------
	// animateup()- Move the two inner divs of the scroller up and in sync
	// -------------------------------------------------------------------

	pausescroller.prototype.animateup=function()
	{
	var scrollerinstance=this
		if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5))
		{
		this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
		this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
		setTimeout(function(){scrollerinstance.animateup()}, 50)
		}
		else
		{
		this.getinline(this.hiddendiv, this.visiblediv)
		this.swapdivs()
		setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
		}
	}

	// -------------------------------------------------------------------
	// swapdivs()- Swap between which is the visible and which is the hidden div
	// -------------------------------------------------------------------

	pausescroller.prototype.swapdivs=function()
	{
	var tempcontainer=this.visiblediv
	this.visiblediv=this.hiddendiv
	this.hiddendiv=tempcontainer
	}

	pausescroller.prototype.getinline=function(div1, div2)
	{
	div1.style.top=this.visibledivtop+"px"
	div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
	}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

	pausescroller.prototype.setmessage=function()
	{
	var scrollerinstance=this
		if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
			setTimeout(function(){scrollerinstance.setmessage()}, 100)
		else
		{
		var i=this.hiddendivpointer
		var ceiling=this.content.length
		this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
		this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
		this.animateup()
		}
	}

	pausescroller.getCSSpadding=function(tickerobj)
	{ //get CSS padding value, if any
		if (tickerobj.currentStyle)
			return tickerobj.currentStyle["paddingTop"]
		else if (window.getComputedStyle) //if DOM2
			return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
		else
		return 0
	}
