var xmlhttp
upImage = new Image();
upImage.src = "/Cuting template/Batans_light.png";
downImage = new Image();
downImage.src = "/Cuting template/Batans_dark.png"
upImagepc = new Image();
upImagepc.src = "/Cuting template/Batans_light_pc.png";
downImagepc = new Image();
downImagepc.src = "/Cuting template/Batans_dark_pc.png";






function alertUser(msg) {
alert(msg);
}







function unfreezediv()
{
var waitindicatordiv = document.getElementById('waitindicatordiv');
var parent = document.getElementById('waitindicatordiv').parentNode;

parent.removeChild(waitindicatordiv); 

waitindicatordiv.style.visibility = 'hidden';
parentdiv.style.visibility = 'visible';

}









function listboxchange(cid,content,pagenum)
{	
	var url="../morecontent.asp?pagenum="+pagenum+"&content="+content+"&cid="+cid;
	window.open (url,'_self');
}







function formCheck(formobj)
        {
            var fieldRequired = Array("mobileno");

            var fieldDescription = Array("Mobile Number");

            var alertMsg = "Please complete the following fields:\n";

            var l_Msg = alertMsg.length;

            for (var i = 0; i < fieldRequired.length; i++){
                var obj = formobj.elements[fieldRequired[i]];
                if (obj){
                    switch(obj.type){
                        case "text":
                            if (obj.value == "" || obj.value == null){
                                alertMsg += " - " + fieldDescription[i] + "\n";
                            }
							if ((obj.value.length<10&&obj.value.length>0)|| obj.value.length>10){
                                alertMsg += " - Valid Mobile Number" + "\n";
                            }
                            break;
                        default:
                    }
                    if (obj.type == undefined){
                        var blnchecked = false;
                        for (var j = 0; j < obj.length; j++){
                            if (obj[j].checked){
                                blnchecked = true;
                            }
                        }
                        if (!blnchecked ){
                            alertMsg += " - " + fieldDescription[i] + "\n";
                        }

                    }
                }
            }
            if (alertMsg.length == l_Msg){
                return true;
            }
            else{
                alert(alertMsg);
                return false;
            }
        }





function popup(url){
  cuteLittleWindow = window.open(url, "littleWindow", "location=no,width=320,height=200"); 
}







function mouseOver(objectname)
{
	if (objectname.name == "image") {
		document.getElementById(objectname.id).src =upImage.src;
	}
	if (objectname.name == "imagepc") {
		document.getElementById(objectname.id).src = upImagepc.src;
	}
}






function mouseOut(objectname)
{
	if (objectname.name == "image") {
		document.getElementById(objectname.id).src =downImage.src;
	}
	if (objectname.name == "imagepc") {
		document.getElementById(objectname.id).src =downImagepc.src;
	}
}









function validatecode()
{

var chosen="";
var len = document.srch.cat.length;
	
for (i = 0; i <len; i++) {
	if (document.srch.cat[i].checked) {
		chosen = document.srch.cat[i].value;
	}
}


// No need of the following code.
//if (chosen == "") {
//	alert("No Location Chosen");
//}
//else {
//	alert(chosen);
//}



var codestr = document.srch.productcode.value;
var firststr = codestr.substr(0,1);
var nums = "0123456789";
var flag=false;
//alert(firststr);

if (codestr.length==0){
	alert("Please enter the value in search field !");
	return;
}


if (firststr=="w" || firststr=="g" || firststr=="a" || firststr=="W" || firststr=="G" || firststr=="A"){
	//alert("You have supplied the valid product code");
	var checkStr = codestr.substring(1);
	// The following code is to check whether the remaining part after the w/g/a intials is a valid numerica string or not.
	//alert(numcode);		
	
	for(i=0;i<checkStr.length;i++)
    {
    	ch = checkStr.charAt(i);
        flag=false;
        for(j=0;j<nums.length;j++)
        {
        	if(ch == nums.charAt(j))
            	flag=true;
            }
            if(!flag)
            {
			showproductbytag(codestr,chosen,1);
			//alert("Please verify the product code.");
            formData.value=checkStr.substring(0,i);
            formData.focus();
            break;                    
            }
        }
				
		// Making the first string attached to the code small.
		if (firststr=="W" || firststr=="w"){
			if (chosen=="w"){
				codestr="w"+codestr.substr(1);
			}else{
				alert("Please verify the product code "+codestr+". It belongs to category wallpaper.");
				return;
			}			
		}
		
		if (firststr=="G" || firststr=="g"){
			if (chosen=="g"){
				codestr="g"+codestr.substr(1);
			}else{
				alert("Please verify the product code "+codestr+". It belongs to category game.");
				return;
			}			
		}
		
		if (firststr=="A" || firststr=="a"){
			if (chosen=="a"){
				codestr="a"+codestr.substr(1);
			}else{
				alert("Please verify the product code "+codestr+". It belongs to category animation.");
				return;
			}			
		}		
		showproduct(codestr);		
}else{
	showproductbytag(codestr,chosen,1);
	//alert("Please verify the product code.");
}

}







function showproduct(str)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
//var url="../selCelebName.asp?typeid="+str;
var url="../searchproduct.asp?productid="+str;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);

xmlhttp.onreadystatechange=stateChanged;
}







function stateChanged()
{
if (xmlhttp.readyState == 4 && document.getElementById("indexbody")!= null )
  {	
  //document.getElementById("product").innerHTML=xmlhttp.responseText;
  //var iFrameBody = document.getElementById("indexbody");
  //iFrameBody.setAttribute('frameBorder','0');
  //iFrameBody.setAttribute('allowtransparency','true');
  //iFrameBody.setAttribute('scrolling','no');
  //iFrameBody.setAttribute('width','840');
  //iFrameBody.setAttribute('height','200');
  //iFrameBody.setAttribute('marginwidth','20');		
  //iFrameBody.setAttribute('marginheight','10');
  //iFrameBody = document.getElementById("indexbody").contentWindow.document.body;
  //iFrameBody.innerHTML = xmlhttp.responseText;
  
  }
}









function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}





function showproductbytag(srtag,content,pagenum)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }  
var url="../searchproductbytag.asp?pagenum="+pagenum+"&content="+content+"&srtag="+srtag;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);

xmlhttp.onreadystatechange=stateChanged;
}





function showtermsdis(str)
{
var url;
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
	if(str=="contact"){
		url="../contactus.asp";
	}else if(str=="wall"){
		url="../morecontent.asp?pagenum=1&content=w&cid=999";
	}else if(str=="game"){
		url="../morecontent.asp?pagenum=1&content=g&cid=999";
	}else if(str=="anim"){
		url="../morecontent.asp?pagenum=1&content=a&cid=999";
	}else if(str=="download"){
		url="../howtodownload.asp";
	}else if(str=="pp"){
		url="../priceplan.asp";		
	}
window.scrollTo(0,0);
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
xmlhttp.onreadystatechange=stateChanged;
}
		






var rootdomain = "http://www.twistcontent.com/"
function ajaxinclude(url) {
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.open('GET', url, false) //get page synchronously 
page_request.send(null)
writecontent(page_request)
}





function writecontent(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
document.write(page_request.responseText)
}



function headerText()
{

document.write("<div align='center' class='style1'>")  ;
document.write("<table width='800' border='0' bordercolor='#DCD8D9' background='Cuting template/backgrond.png'>");
document.write("<tr>");
document.write("<td width='800' height='36' align='right' background='Cuting template/top-bar.png' class='style11'><a href='log.asp' class='Highlight  style6'>Login</a> | Home | Help  </td>");
document.write("</tr>");
document.write("<tr>");
 document.write("<td width='800' height='226' align='center' background='Cuting template/header.jpg'><strong></strong></td>");
document.write("</tr>");
document.write("<tr>");
  document.write("<td width='800' height='28' align='right' valign='top' background='Cuting template/top_bar.png'><form name='srch' onSubmit='validatecode()'>");
  document.write("<input name='productcode' type='text' id='productcode'>");
  document.write("<input name='button' type='button' onClick='showproduct(productcode)' value='Search' />");
 document.write("<span class='style10'>&nbsp;&nbsp;&nbsp;</span>");
document.write("</form>");
 document.write("</td>");
document.write("</tr>");
 document.write("<tr>");
  document.write("<td align='center'><div>");
  document.write("<% if Len(session('sentmsg'))>0 then ");
document.write("Response.write session('sentmsg') ");
document.write(" session('sentmsg')=''");
document.write(" end if %>");
 document.write("</div></td></tr>");
}






function footerText()
{
    alert("</tr>");
}







/***********************************************
 Fool-Proof Date Input Script with DHTML Calendar
 by Jason Moon - http://calendar.moonscript.com/dateinput.cfm
 ************************************************/

// Customizable variables
var DefaultDateFormat = 'MM/DD/YYYY'; // If no date format is supplied, this will be used instead
var HideWait = 3; // Number of seconds before the calendar will disappear
var Y2kPivotPoint = 76; // 2-digit years before this point will be created in the 21st century
var UnselectedMonthText = ''; // Text to display in the 1st month list item when the date isn't required
var FontSize = 11; // In pixels
var FontFamily = 'Tahoma';
var CellWidth = 18;
var CellHeight = 16;
var ImageURL = 'images/calendar.jpg';
var NextURL = 'images/next.gif';
var PrevURL = 'images/prev.gif';
var CalBGColor = 'white';
var TopRowBGColor = 'buttonface';
var DayBGColor = 'lightgrey';

// Global variables
var ZCounter = 100;
var Today = new Date();
var WeekDays = new Array('S','M','T','W','T','F','S');
var MonthDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var MonthNames = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

// Write out the stylesheet definition for the calendar
with (document) {
   writeln('<style>');
   writeln('td.calendarDateInput {letter-spacing:normal;line-height:normal;font-family:' + FontFamily + ',Sans-Serif;font-size:' + FontSize + 'px;}');
   writeln('select.calendarDateInput {letter-spacing:.06em;font-family:Verdana,Sans-Serif;font-size:11px;}');
   writeln('input.calendarDateInput {letter-spacing:.06em;font-family:Verdana,Sans-Serif;font-size:11px;}');
   writeln('</style>');
}

// Only allows certain keys to be used in the date field
function YearDigitsOnly(e) {
   var KeyCode = (e.keyCode) ? e.keyCode : e.which;
   return ((KeyCode == 8) // backspace
        || (KeyCode == 9) // tab
        || (KeyCode == 37) // left arrow
        || (KeyCode == 39) // right arrow
        || (KeyCode == 46) // delete
        || ((KeyCode > 47) && (KeyCode < 58)) // 0 - 9
   );
}

// Gets the absolute pixel position of the supplied element
function GetTagPixels(StartTag, Direction) {
   var PixelAmt = (Direction == 'LEFT') ? StartTag.offsetLeft : StartTag.offsetTop;
   while ((StartTag.tagName != 'BODY') && (StartTag.tagName != 'HTML')) {
      StartTag = StartTag.offsetParent;
      PixelAmt += (Direction == 'LEFT') ? StartTag.offsetLeft : StartTag.offsetTop;
   }
   return PixelAmt;
}

// Is the specified select-list behind the calendar?
function BehindCal(SelectList, CalLeftX, CalRightX, CalTopY, CalBottomY, ListTopY) {
   var ListLeftX = GetTagPixels(SelectList, 'LEFT');
   var ListRightX = ListLeftX + SelectList.offsetWidth;
   var ListBottomY = ListTopY + SelectList.offsetHeight;
   return (((ListTopY < CalBottomY) && (ListBottomY > CalTopY)) && ((ListLeftX < CalRightX) && (ListRightX > CalLeftX)));
}

// For IE, hides any select-lists that are behind the calendar
function FixSelectLists(Over) {
   if (navigator.appName == 'Microsoft Internet Explorer') {
      var CalDiv = this.getCalendar();
      var CalLeftX = CalDiv.offsetLeft;
      var CalRightX = CalLeftX + CalDiv.offsetWidth;
      var CalTopY = CalDiv.offsetTop;
      var CalBottomY = CalTopY + (CellHeight * 9);
      var FoundCalInput = false;
      formLoop :
      for (var j=this.formNumber;j<document.forms.length;j++) {
         for (var i=0;i<document.forms[j].elements.length;i++) {
            if (typeof document.forms[j].elements[i].type == 'string') {
               if ((document.forms[j].elements[i].type == 'hidden') && (document.forms[j].elements[i].name == this.hiddenFieldName)) {
                  FoundCalInput = true;
                  i += 3; // 3 elements between the 1st hidden field and the last year input field
               }
               if (FoundCalInput) {
                  if (document.forms[j].elements[i].type.substr(0,6) == 'select') {
                     ListTopY = GetTagPixels(document.forms[j].elements[i], 'TOP');
                     if (ListTopY < CalBottomY) {
                        if (BehindCal(document.forms[j].elements[i], CalLeftX, CalRightX, CalTopY, CalBottomY, ListTopY)) {
                           document.forms[j].elements[i].style.visibility = (Over) ? 'hidden' : 'visible';
                        }
                     }
                     else break formLoop;
                  }
               }
            }
         }
      }
   }
}

// Displays a message in the status bar when hovering over the calendar days
function DayCellHover(Cell, Over, Color, HoveredDay) {
   Cell.style.backgroundColor = (Over) ? DayBGColor : Color;
   if (Over) {
      if ((this.yearValue == Today.getFullYear()) && (this.monthIndex == Today.getMonth()) && (HoveredDay == Today.getDate())) self.status = 'Click to select today';
      else {
         var Suffix = HoveredDay.toString();
         switch (Suffix.substr(Suffix.length - 1, 1)) {
            case '1' : Suffix += (HoveredDay == 11) ? 'th' : 'st'; break;
            case '2' : Suffix += (HoveredDay == 12) ? 'th' : 'nd'; break;
            case '3' : Suffix += (HoveredDay == 13) ? 'th' : 'rd'; break;
            default : Suffix += 'th'; break;
         }
         self.status = 'Click to select ' + this.monthName + ' ' + Suffix;
      }
   }
   else self.status = '';
   return true;
}

// Sets the form elements after a day has been picked from the calendar
function PickDisplayDay(ClickedDay) {
   this.show();
   var MonthList = this.getMonthList();
   var DayList = this.getDayList();
   var YearField = this.getYearField();
   FixDayList(DayList, GetDayCount(this.displayed.yearValue, this.displayed.monthIndex));
   // Select the month and day in the lists
   for (var i=0;i<MonthList.length;i++) {
      if (MonthList.options[i].value == this.displayed.monthIndex) MonthList.options[i].selected = true;
   }
   for (var j=1;j<=DayList.length;j++) {
      if (j == ClickedDay) DayList.options[j-1].selected = true;
   }
   this.setPicked(this.displayed.yearValue, this.displayed.monthIndex, ClickedDay);
   // Change the year, if necessary
   YearField.value = this.picked.yearPad;
   YearField.defaultValue = YearField.value;
}

// Builds the HTML for the calendar days
function BuildCalendarDays() {
   var Rows = 5;
   if (((this.displayed.dayCount == 31) && (this.displayed.firstDay > 4)) || ((this.displayed.dayCount == 30) && (this.displayed.firstDay == 6))) Rows = 6;
   else if ((this.displayed.dayCount == 28) && (this.displayed.firstDay == 0)) Rows = 4;
   var HTML = '<table width="' + (CellWidth * 7) + '" cellspacing="0" cellpadding="1" style="cursor:default">';
   for (var j=0;j<Rows;j++) {
      HTML += '<tr>';
      for (var i=1;i<=7;i++) {
         Day = (j * 7) + (i - this.displayed.firstDay);
         if ((Day >= 1) && (Day <= this.displayed.dayCount)) {
            if ((this.displayed.yearValue == this.picked.yearValue) && (this.displayed.monthIndex == this.picked.monthIndex) && (Day == this.picked.day)) {
               TextStyle = 'color:white;font-weight:bold;'
               BackColor = DayBGColor;
            }
            else {
               TextStyle = 'color:black;'
               BackColor = CalBGColor;
            }
            if ((this.displayed.yearValue == Today.getFullYear()) && (this.displayed.monthIndex == Today.getMonth()) && (Day == Today.getDate())) TextStyle += 'border:1px solid darkred;padding:0px;';
            HTML += '<td align="center" class="calendarDateInput" style="cursor:default;height:' + CellHeight + ';width:' + CellWidth + ';' + TextStyle + ';background-color:' + BackColor + '" onClick="' + this.objName + '.pickDay(' + Day + ')" onMouseOver="return ' + this.objName + '.displayed.dayHover(this,true,\'' + BackColor + '\',' + Day + ')" onMouseOut="return ' + this.objName + '.displayed.dayHover(this,false,\'' + BackColor + '\')">' + Day + '</td>';
         }
         else HTML += '<td class="calendarDateInput" style="height:' + CellHeight + '">&nbsp;</td>';
      }
      HTML += '</tr>';
   }
   return HTML += '</table>';
}

// Determines which century to use (20th or 21st) when dealing with 2-digit years
function GetGoodYear(YearDigits) {
   if (YearDigits.length == 4) return YearDigits;
   else {
      var Millennium = (YearDigits < Y2kPivotPoint) ? 2000 : 1900;
      return Millennium + parseInt(YearDigits,10);
   }
}

// Returns the number of days in a month (handles leap-years)
function GetDayCount(SomeYear, SomeMonth) {
   return ((SomeMonth == 1) && ((SomeYear % 400 == 0) || ((SomeYear % 4 == 0) && (SomeYear % 100 != 0)))) ? 29 : MonthDays[SomeMonth];
}

// Highlights the buttons
function VirtualButton(Cell, ButtonDown) {
   if (ButtonDown) {
      Cell.style.borderLeft = 'buttonshadow 1px solid';
      Cell.style.borderTop = 'buttonshadow 1px solid';
      Cell.style.borderBottom = 'buttonhighlight 1px solid';
      Cell.style.borderRight = 'buttonhighlight 1px solid';
   }
   else {
      Cell.style.borderLeft = 'buttonhighlight 1px solid';
      Cell.style.borderTop = 'buttonhighlight 1px solid';
      Cell.style.borderBottom = 'buttonshadow 1px solid';
      Cell.style.borderRight = 'buttonshadow 1px solid';
   }
}

// Mouse-over for the previous/next month buttons
function NeighborHover(Cell, Over, DateObj) {
   if (Over) {
      VirtualButton(Cell, false);
      self.status = 'Click to view ' + DateObj.fullName;
   }
   else {
      Cell.style.border = 'buttonface 1px solid';
      self.status = '';
   }
   return true;
}

// Adds/removes days from the day list, depending on the month/year
function FixDayList(DayList, NewDays) {
   var DayPick = DayList.selectedIndex + 1;
   if (NewDays != DayList.length) {
      var OldSize = DayList.length;
      for (var k=Math.min(NewDays,OldSize);k<Math.max(NewDays,OldSize);k++) {
         (k >= NewDays) ? DayList.options[NewDays] = null : DayList.options[k] = new Option(k+1, k+1);
      }
      DayPick = Math.min(DayPick, NewDays);
      DayList.options[DayPick-1].selected = true;
   }
   return DayPick;
}

// Resets the year to its previous valid value when something invalid is entered
function FixYearInput(YearField) {
   var YearRE = new RegExp('\\d{' + YearField.defaultValue.length + '}');
   if (!YearRE.test(YearField.value)) YearField.value = YearField.defaultValue;
}

// Displays a message in the status bar when hovering over the calendar icon
function CalIconHover(Over) {
   var Message = (this.isShowing()) ? 'hide' : 'show';
   self.status = (Over) ? 'Click to ' + Message + ' the calendar' : '';
   return true;
}

// Starts the timer over from scratch
function CalTimerReset() {
   eval('clearTimeout(' + this.timerID + ')');
   eval(this.timerID + '=setTimeout(\'' + this.objName + '.show()\',' + (HideWait * 1000) + ')');
}

// The timer for the calendar
function DoTimer(CancelTimer) {
   if (CancelTimer) eval('clearTimeout(' + this.timerID + ')');
   else {
      eval(this.timerID + '=null');
      this.resetTimer();
   }
}

// Show or hide the calendar
function ShowCalendar() {
   if (this.isShowing()) {
      var StopTimer = true;
      this.getCalendar().style.zIndex = --ZCounter;
      this.getCalendar().style.visibility = 'hidden';
      this.fixSelects(false);
   }
   else {
      var StopTimer = false;
      this.fixSelects(true);
      this.getCalendar().style.zIndex = ++ZCounter;
      this.getCalendar().style.visibility = 'visible';
   }
   this.handleTimer(StopTimer);
   self.status = '';
}

// Hides the input elements when the "blank" month is selected
function SetElementStatus(Hide) {
   this.getDayList().style.visibility = (Hide) ? 'hidden' : 'visible';
   this.getYearField().style.visibility = (Hide) ? 'hidden' : 'visible';
   this.getCalendarLink().style.visibility = (Hide) ? 'hidden' : 'visible';
}

// Sets the date, based on the month selected
function CheckMonthChange(MonthList) {
   var DayList = this.getDayList();
   if (MonthList.options[MonthList.selectedIndex].value == '') {
      DayList.selectedIndex = 0;
      this.hideElements(true);
      this.setHidden('');
   }
   else {
      this.hideElements(false);
      if (this.isShowing()) {
         this.resetTimer(); // Gives the user more time to view the calendar with the newly-selected month
         this.getCalendar().style.zIndex = ++ZCounter; // Make sure this calendar is on top of any other calendars
      }
      var DayPick = FixDayList(DayList, GetDayCount(this.picked.yearValue, MonthList.options[MonthList.selectedIndex].value));
      this.setPicked(this.picked.yearValue, MonthList.options[MonthList.selectedIndex].value, DayPick);
   }
}

// Sets the date, based on the day selected
function CheckDayChange(DayList) {
   if (this.isShowing()) this.show();
   this.setPicked(this.picked.yearValue, this.picked.monthIndex, DayList.selectedIndex+1);
}

// Changes the date when a valid year has been entered
function CheckYearInput(YearField) {
   if ((YearField.value.length == YearField.defaultValue.length) && (YearField.defaultValue != YearField.value)) {
      if (this.isShowing()) {
         this.resetTimer(); // Gives the user more time to view the calendar with the newly-entered year
         this.getCalendar().style.zIndex = ++ZCounter; // Make sure this calendar is on top of any other calendars
      }
      var NewYear = GetGoodYear(YearField.value);
      var MonthList = this.getMonthList();
      var NewDay = FixDayList(this.getDayList(), GetDayCount(NewYear, this.picked.monthIndex));
      this.setPicked(NewYear, this.picked.monthIndex, NewDay);
      YearField.defaultValue = YearField.value;
   }
}

// Holds characteristics about a date
function dateObject() {
   if (Function.call) { // Used when 'call' method of the Function object is supported
      var ParentObject = this;
      var ArgumentStart = 0;
   }
   else { // Used with 'call' method of the Function object is NOT supported
      var ParentObject = arguments[0];
      var ArgumentStart = 1;
   }
   ParentObject.date = (arguments.length == (ArgumentStart+1)) ? new Date(arguments[ArgumentStart+0]) : new Date(arguments[ArgumentStart+0], arguments[ArgumentStart+1], arguments[ArgumentStart+2]);
   ParentObject.yearValue = ParentObject.date.getFullYear();
   ParentObject.monthIndex = ParentObject.date.getMonth();
   ParentObject.monthName = MonthNames[ParentObject.monthIndex];
   ParentObject.fullName = ParentObject.monthName + ' ' + ParentObject.yearValue;
   ParentObject.day = ParentObject.date.getDate();
   ParentObject.dayCount = GetDayCount(ParentObject.yearValue, ParentObject.monthIndex);
   var FirstDate = new Date(ParentObject.yearValue, ParentObject.monthIndex, 1);
   ParentObject.firstDay = FirstDate.getDay();
}

// Keeps track of the date that goes into the hidden field
function storedMonthObject(DateFormat, DateYear, DateMonth, DateDay) {
   (Function.call) ? dateObject.call(this, DateYear, DateMonth, DateDay) : dateObject(this, DateYear, DateMonth, DateDay);
   this.yearPad = this.yearValue.toString();
   this.monthPad = (this.monthIndex < 9) ? '0' + String(this.monthIndex + 1) : this.monthIndex + 1;
   this.dayPad = (this.day < 10) ? '0' + this.day.toString() : this.day;
   this.monthShort = this.monthName.substr(0,3).toUpperCase();
   // Formats the year with 2 digits instead of 4
   if (DateFormat.indexOf('YYYY') == -1) this.yearPad = this.yearPad.substr(2);
   // Define the date-part delimiter
   if (DateFormat.indexOf('/') >= 0) var Delimiter = '/';
   else if (DateFormat.indexOf('-') >= 0) var Delimiter = '-';
   else var Delimiter = '';
   // Determine the order of the months and days
   if (/DD?.?((MON)|(MM?M?))/.test(DateFormat)) {
      this.formatted = this.dayPad + Delimiter;
      this.formatted += (RegExp.$1.length == 3) ? this.monthShort : this.monthPad;
   }
   else if (/((MON)|(MM?M?))?.?DD?/.test(DateFormat)) {
      this.formatted = (RegExp.$1.length == 3) ? this.monthShort : this.monthPad;
      this.formatted += Delimiter + this.dayPad;
   }
   // Either prepend or append the year to the formatted date
   this.formatted = (DateFormat.substr(0,2) == 'YY') ? this.yearPad + Delimiter + this.formatted : this.formatted + Delimiter + this.yearPad;
}

// Object for the current displayed month
function displayMonthObject(ParentObject, DateYear, DateMonth, DateDay) {
   (Function.call) ? dateObject.call(this, DateYear, DateMonth, DateDay) : dateObject(this, DateYear, DateMonth, DateDay);
   this.displayID = ParentObject.hiddenFieldName + '_Current_ID';
   this.getDisplay = new Function('return document.getElementById(this.displayID)');
   this.dayHover = DayCellHover;
   this.goCurrent = new Function(ParentObject.objName + '.getCalendar().style.zIndex=++ZCounter;' + ParentObject.objName + '.setDisplayed(Today.getFullYear(),Today.getMonth());');
   if (ParentObject.formNumber >= 0) this.getDisplay().innerHTML = this.fullName;
}

// Object for the previous/next buttons
function neighborMonthObject(ParentObject, IDText, DateMS) {
   (Function.call) ? dateObject.call(this, DateMS) : dateObject(this, DateMS);
   this.buttonID = ParentObject.hiddenFieldName + '_' + IDText + '_ID';
   this.hover = new Function('C','O','NeighborHover(C,O,this)');
   this.getButton = new Function('return document.getElementById(this.buttonID)');
   this.go = new Function(ParentObject.objName + '.getCalendar().style.zIndex=++ZCounter;' + ParentObject.objName + '.setDisplayed(this.yearValue,this.monthIndex);');
   if (ParentObject.formNumber >= 0) this.getButton().title = this.monthName;
}

// Sets the currently-displayed month object
function SetDisplayedMonth(DispYear, DispMonth) {
   this.displayed = new displayMonthObject(this, DispYear, DispMonth, 1);
   // Creates the previous and next month objects
   this.previous = new neighborMonthObject(this, 'Previous', this.displayed.date.getTime() - 86400000);
   this.next = new neighborMonthObject(this, 'Next', this.displayed.date.getTime() + (86400000 * (this.displayed.dayCount + 1)));
   // Creates the HTML for the calendar
   if (this.formNumber >= 0) this.getDayTable().innerHTML = this.buildCalendar();
}

// Sets the current selected date
function SetPickedMonth(PickedYear, PickedMonth, PickedDay) {
   this.picked = new storedMonthObject(this.format, PickedYear, PickedMonth, PickedDay);
   this.setHidden(this.picked.formatted);
   this.setDisplayed(PickedYear, PickedMonth);
}

// The calendar object
function calendarObject(DateName, DateFormat, DefaultDate) {

   /* Properties */
   this.hiddenFieldName = DateName;
   this.monthListID = DateName + '_Month_ID';
   this.dayListID = DateName + '_Day_ID';
   this.yearFieldID = DateName + '_Year_ID';
   this.monthDisplayID = DateName + '_Current_ID';
   this.calendarID = DateName + '_ID';
   this.dayTableID = DateName + '_DayTable_ID';
   this.calendarLinkID = this.calendarID + '_Link';
   this.timerID = this.calendarID + '_Timer';
   this.objName = DateName + '_Object';
   this.format = DateFormat;
   this.formNumber = -1;
   this.picked = null;
   this.displayed = null;
   this.previous = null;
   this.next = null;

   /* Methods */
   this.setPicked = SetPickedMonth;
   this.setDisplayed = SetDisplayedMonth;
   this.checkYear = CheckYearInput;
   this.fixYear = FixYearInput;
   this.changeMonth = CheckMonthChange;
   this.changeDay = CheckDayChange;
   this.resetTimer = CalTimerReset;
   this.hideElements = SetElementStatus;
   this.show = ShowCalendar;
   this.handleTimer = DoTimer;
   this.iconHover = CalIconHover;
   this.buildCalendar = BuildCalendarDays;
   this.pickDay = PickDisplayDay;
   this.fixSelects = FixSelectLists;
   this.setHidden = new Function('D','if (this.formNumber >= 0) this.getHiddenField().value=D');
   // Returns a reference to these elements
   this.getHiddenField = new Function('return document.forms[this.formNumber].elements[this.hiddenFieldName]');
   this.getMonthList = new Function('return document.getElementById(this.monthListID)');
   this.getDayList = new Function('return document.getElementById(this.dayListID)');
   this.getYearField = new Function('return document.getElementById(this.yearFieldID)');
   this.getCalendar = new Function('return document.getElementById(this.calendarID)');
   this.getDayTable = new Function('return document.getElementById(this.dayTableID)');
   this.getCalendarLink = new Function('return document.getElementById(this.calendarLinkID)');
   this.getMonthDisplay = new Function('return document.getElementById(this.monthDisplayID)');
   this.isShowing = new Function('return !(this.getCalendar().style.visibility != \'visible\')');

   /* Constructor */
   // Functions used only by the constructor
   function getMonthIndex(MonthAbbr) { // Returns the index (0-11) of the supplied month abbreviation
      for (var MonPos=0;MonPos<MonthNames.length;MonPos++) {
         if (MonthNames[MonPos].substr(0,3).toUpperCase() == MonthAbbr.toUpperCase()) break;
      }
      return MonPos;
   }
   function SetGoodDate(CalObj, Notify) { // Notifies the user about their bad default date, and sets the current system date
      CalObj.setPicked(Today.getFullYear(), Today.getMonth(), Today.getDate());
      if (Notify) alert('WARNING: The supplied date is not in valid \'' + DateFormat + '\' format: ' + DefaultDate + '.\nTherefore, the current system date will be used instead: ' + CalObj.picked.formatted);
   }
   // Main part of the constructor
   if (DefaultDate != '') {
      if ((this.format == 'YYYYMMDD') && (/^(\d{4})(\d{2})(\d{2})$/.test(DefaultDate))) this.setPicked(RegExp.$1, parseInt(RegExp.$2,10)-1, RegExp.$3);
      else {
         // Get the year
         if ((this.format.substr(0,2) == 'YY') && (/^(\d{2,4})(-|\/)/.test(DefaultDate))) { // Year is at the beginning
            var YearPart = GetGoodYear(RegExp.$1);
            // Determine the order of the months and days
            if (/(-|\/)(\w{1,3})(-|\/)(\w{1,3})$/.test(DefaultDate)) {
               var MidPart = RegExp.$2;
               var EndPart = RegExp.$4;
               if (/D$/.test(this.format)) { // Ends with days
                  var DayPart = EndPart;
                  var MonthPart = MidPart;
               }
               else {
                  var DayPart = MidPart;
                  var MonthPart = EndPart;
               }
               MonthPart = (/\d{1,2}/i.test(MonthPart)) ? parseInt(MonthPart,10)-1 : getMonthIndex(MonthPart);
               this.setPicked(YearPart, MonthPart, DayPart);
            }
            else SetGoodDate(this, true);
         }
         else if (/(-|\/)(\d{2,4})$/.test(DefaultDate)) { // Year is at the end
            var YearPart = GetGoodYear(RegExp.$2);
            // Determine the order of the months and days
            if (/^(\w{1,3})(-|\/)(\w{1,3})(-|\/)/.test(DefaultDate)) {
               if (this.format.substr(0,1) == 'D') { // Starts with days
                  var DayPart = RegExp.$1;
                  var MonthPart = RegExp.$3;
               }
               else { // Starts with months
                  var MonthPart = RegExp.$1;
                  var DayPart = RegExp.$3;
               }
               MonthPart = (/\d{1,2}/i.test(MonthPart)) ? parseInt(MonthPart,10)-1 : getMonthIndex(MonthPart);
               this.setPicked(YearPart, MonthPart, DayPart);
            }
            else SetGoodDate(this, true);
         }
         else SetGoodDate(this, true);
      }
   }
}

// Main function that creates the form elements
function DateInput(DateName, Required, DateFormat, DefaultDate) {
   if (arguments.length == 0) document.writeln('<span style="color:red;font-size:' + FontSize + 'px;font-family:' + FontFamily + ';">ERROR: Missing required parameter in call to \'DateInput\': [name of hidden date field].</span>');
   else {
      // Handle DateFormat
      if (arguments.length < 3) { // The format wasn't passed in, so use default
         DateFormat = DefaultDateFormat;
         if (arguments.length < 2) Required = false;
      }
      else if (/^(Y{2,4}(-|\/)?)?((MON)|(MM?M?)|(DD?))(-|\/)?((MON)|(MM?M?)|(DD?))((-|\/)Y{2,4})?$/i.test(DateFormat)) DateFormat = DateFormat.toUpperCase();
      else { // Passed-in DateFormat was invalid, use default format instead
         var AlertMessage = 'WARNING: The supplied date format for the \'' + DateName + '\' field is not valid: ' + DateFormat + '\nTherefore, the default date format will be used instead: ' + DefaultDateFormat;
         DateFormat = DefaultDateFormat;
         if (arguments.length == 4) { // DefaultDate was passed in with an invalid date format
            var CurrentDate = new storedMonthObject(DateFormat, Today.getFullYear(), Today.getMonth(), Today.getDate());
            AlertMessage += '\n\nThe supplied date (' + DefaultDate + ') cannot be interpreted with the invalid format.\nTherefore, the current system date will be used instead: ' + CurrentDate.formatted;
            DefaultDate = CurrentDate.formatted;
         }
         alert(AlertMessage);
      }
      // Define the current date if it wasn't set already
      if (!CurrentDate) var CurrentDate = new storedMonthObject(DateFormat, Today.getFullYear(), Today.getMonth(), Today.getDate());
      // Handle DefaultDate
      if (arguments.length < 4) { // The date wasn't passed in
         DefaultDate = (Required) ? CurrentDate.formatted : ''; // If required, use today's date
      }
      // Creates the calendar object!
      eval(DateName + '_Object=new calendarObject(\'' + DateName + '\',\'' + DateFormat + '\',\'' + DefaultDate + '\')');
      // Determine initial viewable state of day, year, and calendar icon
      if ((Required) || (arguments.length == 4)) {
         var InitialStatus = '';
         var InitialDate = eval(DateName + '_Object.picked.formatted');
      }
      else {
         var InitialStatus = ' style="visibility:hidden"';
         var InitialDate = '';
         eval(DateName + '_Object.setPicked(' + Today.getFullYear() + ',' + Today.getMonth() + ',' + Today.getDate() + ')');
      }
      // Create the form elements
      with (document) {
         writeln('<input type="hidden" name="' + DateName + '" value="' + InitialDate + '">');
         // Find this form number
         for (var f=0;f<forms.length;f++) {
            for (var e=0;e<forms[f].elements.length;e++) {
               if (typeof forms[f].elements[e].type == 'string') {
                  if ((forms[f].elements[e].type == 'hidden') && (forms[f].elements[e].name == DateName)) {
                     eval(DateName + '_Object.formNumber='+f);
                     break;
                  }
               }
            }
         }
         writeln('<table cellpadding="0" cellspacing="2"><tr>' + String.fromCharCode(13) + '<td valign="middle">');
         writeln('<select class="calendarDateInput" id="' + DateName + '_Month_ID" onChange="' + DateName + '_Object.changeMonth(this)">');
         if (!Required) {
            var NoneSelected = (DefaultDate == '') ? ' selected' : '';
            writeln('<option value=""' + NoneSelected + '>' + UnselectedMonthText + '</option>');
         }
         for (var i=0;i<12;i++) {
            MonthSelected = ((DefaultDate != '') && (eval(DateName + '_Object.picked.monthIndex') == i)) ? ' selected' : '';
            writeln('<option value="' + i + '"' + MonthSelected + '>' + MonthNames[i].substr(0,3) + '</option>');
         }
         writeln('</select>' + String.fromCharCode(13) + '</td>' + String.fromCharCode(13) + '<td valign="middle">');
         writeln('<select' + InitialStatus + ' class="calendarDateInput" id="' + DateName + '_Day_ID" onChange="' + DateName + '_Object.changeDay(this)">');
         for (var j=1;j<=eval(DateName + '_Object.picked.dayCount');j++) {
            DaySelected = ((DefaultDate != '') && (eval(DateName + '_Object.picked.day') == j)) ? ' selected' : '';
            writeln('<option' + DaySelected + '>' + j + '</option>');
         }
         writeln('</select>' + String.fromCharCode(13) + '</td>' + String.fromCharCode(13) + '<td valign="middle">');
         writeln('<input' + InitialStatus + ' class="calendarDateInput" type="text" id="' + DateName + '_Year_ID" size="' + eval(DateName + '_Object.picked.yearPad.length') + '" maxlength="' + eval(DateName + '_Object.picked.yearPad.length') + '" title="Year" value="' + eval(DateName + '_Object.picked.yearPad') + '" onKeyPress="return YearDigitsOnly(window.event)" onKeyUp="' + DateName + '_Object.checkYear(this)" onBlur="' + DateName + '_Object.fixYear(this)">');
         write('<td valign="middle">' + String.fromCharCode(13) + '<a' + InitialStatus + ' id="' + DateName + '_ID_Link" href="javascript:' + DateName + '_Object.show()" onMouseOver="return ' + DateName + '_Object.iconHover(true)" onMouseOut="return ' + DateName + '_Object.iconHover(false)"><img src="' + ImageURL + '" align="baseline" title="Calendar" border="0"></a>&nbsp;');
         writeln('<span id="' + DateName + '_ID" style="position:absolute;visibility:hidden;width:' + (CellWidth * 7) + 'px;background-color:' + CalBGColor + ';border:1px solid dimgray;" onMouseOver="' + DateName + '_Object.handleTimer(true)" onMouseOut="' + DateName + '_Object.handleTimer(false)">');
         writeln('<table width="' + (CellWidth * 7) + '" cellspacing="0" cellpadding="1">' + String.fromCharCode(13) + '<tr style="background-color:' + TopRowBGColor + ';">');
         writeln('<td id="' + DateName + '_Previous_ID" style="cursor:default" align="center" class="calendarDateInput" style="height:' + CellHeight + '" onClick="' + DateName + '_Object.previous.go()" onMouseDown="VirtualButton(this,true)" onMouseUp="VirtualButton(this,false)" onMouseOver="return ' + DateName + '_Object.previous.hover(this,true)" onMouseOut="return ' + DateName + '_Object.previous.hover(this,false)" title="' + eval(DateName + '_Object.previous.monthName') + '"><img src="' + PrevURL + '"></td>');
         writeln('<td id="' + DateName + '_Current_ID" style="cursor:pointer" align="center" class="calendarDateInput" style="height:' + CellHeight + '" colspan="5" onClick="' + DateName + '_Object.displayed.goCurrent()" onMouseOver="self.status=\'Click to view ' + CurrentDate.fullName + '\';return true;" onMouseOut="self.status=\'\';return true;" title="Show Current Month">' + eval(DateName + '_Object.displayed.fullName') + '</td>');
         writeln('<td id="' + DateName + '_Next_ID" style="cursor:default" align="center" class="calendarDateInput" style="height:' + CellHeight + '" onClick="' + DateName + '_Object.next.go()" onMouseDown="VirtualButton(this,true)" onMouseUp="VirtualButton(this,false)" onMouseOver="return ' + DateName + '_Object.next.hover(this,true)" onMouseOut="return ' + DateName + '_Object.next.hover(this,false)" title="' + eval(DateName + '_Object.next.monthName') + '"><img src="' + NextURL + '"></td></tr>' + String.fromCharCode(13) + '<tr>');
         for (var w=0;w<7;w++) writeln('<td width="' + CellWidth + '" align="center" class="calendarDateInput" style="height:' + CellHeight + ';width:' + CellWidth + ';font-weight:bold;border-top:1px solid dimgray;border-bottom:1px solid dimgray;">' + WeekDays[w] + '</td>');
         writeln('</tr>' + String.fromCharCode(13) + '</table>' + String.fromCharCode(13) + '<span id="' + DateName + '_DayTable_ID">' + eval(DateName + '_Object.buildCalendar()') + '</span>' + String.fromCharCode(13) + '</span>' + String.fromCharCode(13) + '</td>' + String.fromCharCode(13) + '</tr>' + String.fromCharCode(13) + '</table>');
      }
   }
}







// This code is for the games description as the mouse pointer comes on the games images
var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""






function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}






function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}








function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}






function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
document.onmousemove=positiontip






var ADBRITE;if(!ADBRITE){ADBRITE={};}
if(!ADBRITE.INLINE){ADBRITE.INLINE={};ADBRITE.INLINE.keyword_to_id={};ADBRITE.INLINE.keyword_to_id['cars']=1;ADBRITE.INLINE.keywords_to_inline=[['cars']];ADBRITE.INLINE.inline_text_color='#006600';ADBRITE.INLINE.ad_width=325;ADBRITE.INLINE.ad_height=135;ADBRITE.INLINE.config={'sid':0,'open_in_new_window':true,'max_words_to_inline':8,'max_char_for_keywords':1500,'max_char_for_textnodes':5000,'min_char_per_keyword':3};ADBRITE.INLINE.time_limits={};}
var ab_sUserAgent=navigator.userAgent;var ab_fAppVersion=parseFloat(navigator.appVersion);var ab_isKHTML=ab_sUserAgent.indexOf('KHTML')>-1||ab_sUserAgent.indexOf('Konqueror')>-1||ab_sUserAgent.indexOf('AppleWebKit')>-1;var ab_isMoz=ab_sUserAgent.indexOf("Gecko")>-1&&!ab_isKHTML;var ab_isMinMoz1=ab_isMinMoz1_4=ab_isMinMoz1_5=false;var ab_isOpera=ab_sUserAgent.indexOf('Opera')>-1;var ab_isIE=ab_sUserAgent.indexOf('compatible')>-1&&ab_sUserAgent.indexOf('MSIE')>-1&&!ab_isOpera;var ab_isMinIE4=ab_isMinIE5=ab_isMinIE5_5=ab_isMinIE6=false;function ab_compareVersions(sVersion1,sVersion2){var aVersion1=sVersion1.split('.');var aVersion2=sVersion2.split('.');if(aVersion1.length>aVersion2.length)
for(var i=0;i<aVersion1.length-aVersion2.length;i++)
aVersion2.push('0');else if(aVersion1.length<aVersion2.length)
for(vari=0;i<aVersion2.length-aVersion1.length;i++)
aVerison1.push('0');for(var i=0;i<aVersion1.length;i++){if(aVersion1[i]<aVersion2[i])
return-1;else if(aVersion1[i]>aVersion2[i])
return 1;}
return 0;}
if(ab_isMoz){var ab_reMoz=new RegExp("rv:(\\d+\\.\\d+(?:\\.\\d+)?)");ab_reMoz.test(ab_sUserAgent);ab_isMinMoz1=ab_compareVersions(RegExp["$1"],"1.0")>=0;ab_isMinMoz1_4=ab_compareVersions(RegExp["$1"],"1.4")>=0;ab_isMinMoz1_5=ab_compareVersions(RegExp["$1"],"1.5")>=0;}
if(ab_isIE){var ab_re_IE=new RegExp('MSIE (\\d+\\.\\d+)');ab_re_IE.test(ab_sUserAgent);var ab_fIEVersion=parseFloat(RegExp['$1']);ab_isMinIE4=ab_fIEVersion>=4;ab_isMinIE5=ab_fIEVersion>=5;ab_isMinIE5_5=ab_fIEVersion>=5.5;ab_isMinIE6=ab_fIEVersion>=6.0;}
ADBRITE.INLINE.is_inlined;ADBRITE.INLINE.start_time;ADBRITE.INLINE.keywords_already_inlined=[];ADBRITE.INLINE.keywords_ids_already_inlined_str="";ADBRITE.INLINE.text_nodes=[];ADBRITE.INLINE.adbriteinline_tags=[];ADBRITE.INLINE.tags_to_ignore={'A':1,'H1':1,'H2':1,'H3':1,'H4':1,'H5':1,'H6':1,'TH':1,'SCRIPT':1,'NOSCRIPT':1,'SELECT':1,'IFRAME':1,'TITLE':1,'TEXTAREA':1,'DT':1,'DL':1,'DD':1,'FIELDSET':1,'LEGEND':1,'ACRONYM':1,'ADDRESS':1,'LABEL':1}
ADBRITE.INLINE.current_textnode=0;ADBRITE.INLINE.unfiltered_keywords=[];ADBRITE.INLINE.filtered_keywords={};ADBRITE.INLINE.filtered_keywords.ab_length=0;ADBRITE.INLINE.ad_url='';ADBRITE.INLINE.inline_ad_timeout_handle;ADBRITE.INLINE.keyword=null;ADBRITE.INLINE.div_keyword=null;ADBRITE.INLINE.display_ad=false;ADBRITE.INLINE.keyword_set_inlined=false;ADBRITE.stopword_list=[];ADBRITE.append_onload=function(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}}
ADBRITE.append_script=function(url,span_id){var span_to_append=document.getElementById(span_id);var ab_script=document.createElement('script');ab_script.src=url;ab_script.type='text/javascript';span_to_append.appendChild(ab_script);}
ADBRITE.element_in_array=function(element,element_array){for(var k=0;k<element_array.length;k++)
if(element_array[k]==element)return true;return false;}
ADBRITE.force_browser_cache_of_image=function(url){(new Image(10,10)).src=url;}
ADBRITE.find_Pos_X=function(obj){var curleft=0;if(obj.offsetParent){while(obj){curleft+=obj.offsetLeft;obj=obj.offsetParent;}}else if(obj.x)
curleft+=obj.x;return curleft;}
ADBRITE.find_Pos_Y=function(obj){var curtop=0;if(obj.offsetParent){while(obj){curtop+=obj.offsetTop;obj=obj.offsetParent;}}else if(obj.y)
curtop+=obj.y;return curtop;}
ADBRITE.find_page_width=function(){var x;if(self.innerWidth)x=self.innerWidth;else if(document.documentElement.clientWidth&&document.documentElement.clientWidth)x=document.documentElement.clientWidth;else if(document.body.clientWidth)x=document.body.clientWidth;return x;}
ADBRITE.find_page_height=function(){var y;if(self.innerHeight)y=self.innerHeight;else if(document.documentElement.clientHeight&&document.documentElement.clientHeight)y=document.documentElement.clientHeight;else if(document.body.clientHeight)y=document.body.clientHeight;return y;}
ADBRITE.find_scroll_y=function(){var y;if(self.pageYOffset)y=self.pageYOffset;else if(document.documentElement&&document.documentElement.scrollTop)y=document.documentElement.scrollTop;else if(document.body)y=document.body.scrollTop;return y;}
ADBRITE.INLINE.inline_keyword=function(keyword,keyword_regex,node_array_index){ADBRITE.INLINE.keywords_already_inlined.push(keyword);ADBRITE.INLINE.keyword_set_inlined=true;var keyword_id_str=''+ADBRITE.INLINE.keyword_to_id[keyword];ADBRITE.INLINE.config.max_char_for_keywords-=(keyword_id_str.length+1);if(ADBRITE.INLINE.keywords_ids_already_inlined_str.length>0){ADBRITE.INLINE.keywords_ids_already_inlined_str+=',';}
ADBRITE.INLINE.keywords_ids_already_inlined_str+=keyword_id_str;var node_to_modify=ADBRITE.INLINE.text_nodes[node_array_index];var broken_apart_text=null;var pre_text=null;var post_text='';var inline_text=null;var inline_tag=null;var pre_broken_node_text=node_to_modify.data;var parent_node=node_to_modify.parentNode;var start_id=node_to_modify.data.toLowerCase().indexOf(keyword.toLowerCase());var end_id=start_id+keyword.length;var orig_keyword=node_to_modify.data.slice(start_id,end_id);broken_apart_text=node_to_modify.data.split(keyword_regex);if(broken_apart_text.length==0){pre_text=document.createTextNode('');post_text=document.createTextNode('');}else if(broken_apart_text.length==1){if(pre_broken_node_text.toLowerCase().indexOf(keyword.toLowerCase())==0){pre_text='';post_text=broken_apart_text[0];}else{pre_text=broken_apart_text[0];post_text='';}
pre_text=document.createTextNode(pre_text);post_text=document.createTextNode(post_text);}else{if(broken_apart_text.length>2){for(var i=1;i<(broken_apart_text.length-1);i++)
post_text+=broken_apart_text[i]+keyword;post_text+=broken_apart_text[(broken_apart_text.length-1)];}else
post_text=broken_apart_text[1];pre_text=document.createTextNode(broken_apart_text[0]);post_text=document.createTextNode(post_text);}
if(!document.getElementById('AdBriteInlineAd_'+keyword)){var inline_tag=document.createElement('ispan');inline_tag.id='AdBriteInlineAd_'+keyword;inline_tag.keyword=keyword;inline_tag.onmouseover=ADBRITE.INLINE.prep_and_show_inline_ad;inline_tag.onmouseout=ADBRITE.INLINE.hide_inline_ad_timer;var itsty=inline_tag.style;itsty.display='inline';itsty.cursor='pointer';itsty.color=ADBRITE.INLINE.inline_text_color;itsty.textDecoration='none';itsty.background='transparent';itsty.textDecoration='underline';itsty.margin='0 0 -1px 0';itsty.padding='0 0 1px 0';itsty.borderColor=ADBRITE.INLINE.inline_text_color;itsty.borderStyle='solid';itsty.borderWidth='0 0 1px 0';inline_tag.innerHTML=orig_keyword;parent_node.replaceChild(post_text,node_to_modify);parent_node.insertBefore(inline_tag,post_text);parent_node.insertBefore(pre_text,inline_tag);ADBRITE.INLINE.text_nodes=[];ADBRITE.INLINE.populate_text_nodes();}}
ADBRITE.INLINE.create_inline_div=function(){if(!document.getElementById('adbrite_inline_div')){var inline=document.createElement('ispan');inline.className='noadbriteinline';inline.id='adbrite_inline_div';inline.onmouseover=ADBRITE.INLINE.reset_display_inline_ad;inline.onmouseout=ADBRITE.INLINE.hide_inline_ad_timer;var isty=inline.style;isty.display='none';isty.position='absolute';isty.zIndex='32767';isty.width=ADBRITE.INLINE.ad_width+'px';isty.height=ADBRITE.INLINE.ad_height+'px';isty.overflow="hidden";isty.backgroundImage='url('+ADBRITE.INLINE.ad_background+')';isty.backgroundPosition='top';isty.backgroundRepeat='no-repeat';isty.opacity=.95;isty.filter='alpha(opacity=95)';isty.textAlign='left';document.getElementsByTagName('body')[0].appendChild(inline);var linkBack=document.createElement('ispan');var lbsty=linkBack.style;lbsty.display="inline";lbsty.whiteSpace="nowrap";lbsty.position="absolute";lbsty.top="9px";lbsty.right="14px";lbsty.hieght="14px";lbsty.width="40px";lbsty.cursor="pointer";lbsty.fontSize="14px";lbsty.lineHeight="14px";linkBack.innerHTML='&nbsp;';linkBack.onclick=function(){window.open('http://'+ADBRITE.INLINE.supplier)}
inline.appendChild(linkBack);var about=document.createElement('ispan');var absty=about.style;absty.fontSize="11px";absty.display="inline";absty.fontWeight="bold";absty.color="#FFF";absty.position="absolute";absty.fontFamily="Arial,Helvetica,sans-serif";absty.top="8px";absty.left="10px";absty.cursor="pointer";about.onclick=function(){window.open('http://'+ADBRITE.INLINE.supplier+'/mb/about_inline.php?sid='+ADBRITE.INLINE.config.sid,'AboutInline','menubar=no,location=no,resizeable=no,scrollbars=no,status=no,left=100,top=100,height=300,width=300');}
about.appendChild(document.createTextNode("About this advertisement"));inline.appendChild(about);var w=document.createElement('ispan');w.style.display='block';w.style.width=(ADBRITE.INLINE.ad_width-34)+'px';inline.appendChild(w);var a=document.createElement('a');a.id='adbrite-inline-target-url';a.onclick=function(){return false;}
var asty=a.style;asty.padding='0';asty.margin='0';asty.border='none';asty.color="#000";asty.fontWeight='normal';asty.textDecoration='none';asty.background='transparent';asty.cursor='pointer';asty.position='relative';asty.top='33px';asty.left='24px';w.appendChild(a);var head=document.createElement('ispan');head.id="adbrite-inline-headline";var hsty=head.style;hsty.fontSize="20px";hsty.fontFamily="Arial,Helvetica,sans-serif";hsty.fontWeight="bold";hsty.color="#00F";hsty.textDecoration="underline";hsty.whiteSpace="nowrap";a.appendChild(head);a.appendChild(document.createElement('br'));var text=document.createElement('ispan');text.id="adbrite-inline-adtext";var tsty=text.style;tsty.fontSize="13px";tsty.lineHeight="15px";tsty.fontFamily="Verdana,Arial,Helvetica,sans-serif";a.appendChild(text);a.appendChild(document.createElement('br'));var url=document.createElement('ispan');url.id="adbrite-inline-display-url";urlsty=url.style;urlsty.fontSize="11px";urlsty.lineHeight="18px";urlsty.fontFamily="Verdana,Arial,Helvetica,sans-serif";urlsty.textDecoration="underline";urlsty.color="#008000";a.appendChild(url);var yah=document.createElement('ispan');yah.id="adbrite-inline-your-ad-here";var ysty=yah.style;ysty.display="inline";ysty.position="absolute";ysty.bottom="16px";ysty.right="15px";ysty.fontFamily="Verdana,Arial,Helvetica,sans-serif";ysty.fontSize="11px";ysty.cursor="pointer";ysty.color="#00F";ysty.textDecoration='underline';yah.appendChild(document.createTextNode('Your ad here'));inline.appendChild(yah);}}
ADBRITE.INLINE.prep_and_show_inline_ad=function(){ADBRITE.INLINE.keyword=this.keyword;if(ADBRITE.INLINE.div_keyword!=ADBRITE.INLINE.keyword){ADBRITE.INLINE.display_ad=true;var page_width=ADBRITE.find_page_width();var page_height=ADBRITE.find_page_height();var scroll_y=ADBRITE.find_scroll_y();var div_left=ADBRITE.find_Pos_X(this);var div_top=ADBRITE.find_Pos_Y(this);var adbrite_inline_div=document.getElementById('adbrite_inline_div');adbrite_inline_div.style.display='none';if((div_left+ADBRITE.INLINE.ad_width)>page_width+30)
adbrite_inline_div.style.left=(div_left-(div_left+ADBRITE.INLINE.ad_width-page_width)-30)+'px';else
adbrite_inline_div.style.left=div_left+'px';if((div_top-ADBRITE.INLINE.ad_height)<0)adbrite_inline_div.style.top=(div_top+20)+'px';else if((div_top-ADBRITE.INLINE.ad_height)<scroll_y)adbrite_inline_div.style.top=(div_top+20)+'px';else adbrite_inline_div.style.top=(div_top-ADBRITE.INLINE.ad_height)+'px';ADBRITE.INLINE.display_inline_ad();}else
ADBRITE.INLINE.reset_display_inline_ad();}
ADBRITE.INLINE.display_inline_ad=function(){if(ADBRITE.INLINE.keyword!=ADBRITE.INLINE.div_keyword){ADBRITE.INLINE.div_keyword=ADBRITE.INLINE.keyword;var adbrite_inline_div=document.getElementById('adbrite_inline_div');ADBRITE.INLINE.populate_inline_div('Loading...','','','');ADBRITE.INLINE.load_inline_ad();adbrite_inline_div.style.display='block';}}
ADBRITE.INLINE.load_inline_ad=function(){var headline='Shop for a cool car';var text='There\'s no better way to get from Point A to Point B than a good old fashioned automobile.';var url='#';var display_url='www.ShopForACar.com';ADBRITE.INLINE.populate_and_display_inline_div(headline,text,url,display_url);}
ADBRITE.INLINE.populate_and_display_inline_div=function(ad_headline,ad_text,ad_url,display_url){ADBRITE.INLINE.populate_inline_div(ad_headline,ad_text,ad_url,display_url);var keyword_span_id='AdBriteInlineAd_'+ADBRITE.INLINE.keyword;ADBRITE.INLINE.ad_url=ad_url;document.getElementById(keyword_span_id).href=ad_url;}
ADBRITE.INLINE.populate_inline_div=function(ad_headline,ad_text,ad_url,display_url){var a=document.getElementById('adbrite-inline-target-url');a.href=ad_url;a.target=(ADBRITE.INLINE.config.open_in_new_window)?'_blank':'_top';var head=document.getElementById('adbrite-inline-headline');head.innerHTML=unescape(decodeURIComponent(ad_headline));var text=document.getElementById('adbrite-inline-adtext');text.innerHTML=unescape(decodeURIComponent(ad_text));if(display_url&&display_url!=''){var url=document.getElementById('adbrite-inline-display-url');url.innerHTML=unescape(decodeURIComponent(display_url));url.href=ad_url;url.target=(ADBRITE.INLINE.config.open_in_new_window)?'_blank':'_top';}}
ADBRITE.INLINE.hide_inline_ad_timer=function(){ADBRITE.INLINE.display_ad=false;ADBRITE.INLINE.inline_ad_timeout_handle=window.setTimeout(ADBRITE.INLINE.hide_inline_ad,1000);}
ADBRITE.INLINE.hide_inline_ad=function(){if(ADBRITE.INLINE.display_ad==false){var keyword_span_id='AdBriteInlineAd_'+ADBRITE.INLINE.keyword;document.getElementById(keyword_span_id).onclick='';ADBRITE.INLINE.div_keyword=null;var adbrite_inline_div=document.getElementById('adbrite_inline_div');adbrite_inline_div.style.display='none';}}
ADBRITE.INLINE.reset_display_inline_ad=function(){ADBRITE.INLINE.display_ad=true;window.clearTimeout(ADBRITE.INLINE.inline_ad_timeout_handle);}
ADBRITE.INLINE.reset_text_nodes=function(){ADBRITE.INLINE.text_nodes="";ADBRITE.INLINE.text_nodes=[];}
ADBRITE.INLINE.populate_text_nodes=function(){if(ADBRITE.INLINE.text_nodes.length==0){ADBRITE.INLINE.scan_nodes(document.getElementsByTagName('body')[0],true);if(ADBRITE.INLINE.adbriteinline_tags.length>0){ADBRITE.INLINE.reset_text_nodes();var length=ADBRITE.INLINE.adbriteinline_tags.length;for(var i=0;i<length;i++)
ADBRITE.INLINE.scan_nodes(ADBRITE.INLINE.adbriteinline_tags[i],false);}}}
ADBRITE.INLINE.scan_nodes=function(node,log_classname){if(log_classname==true&&ADBRITE.INLINE.tags_to_ignore[node.nodeName.toUpperCase()]!=1)
if(node.className&&node.className.toLowerCase()=='adbriteinline')
ADBRITE.INLINE.adbriteinline_tags.push(node);if(node.nodeType==3){if(node.data.replace(/\s+/g,''))ADBRITE.INLINE.text_nodes.push(node);}else{for(var next_node=node.firstChild;next_node!=null;next_node=next_node.nextSibling){var scan_node=true;if(ADBRITE.INLINE.tags_to_ignore[next_node.nodeName.toUpperCase()]==1)scan_node=false;if(next_node.className&&(next_node.className.toLowerCase()).indexOf('noadbriteinline')!=-1)scan_node=false;if(scan_node)ADBRITE.INLINE.scan_nodes(next_node,log_classname);}}}
ADBRITE.INLINE.find_keyword=function(keyword){var keyword_regex=new RegExp("\\b"+keyword+"\\b",'i');for(var i=0;i<ADBRITE.INLINE.text_nodes.length;i++){if(ADBRITE.INLINE.text_nodes[i].data.search(keyword_regex)>-1){ADBRITE.INLINE.inline_keyword(keyword,keyword_regex,i);break;}}}
ADBRITE.INLINE.get_next_keyword=function(){var keyword="";while(ADBRITE.INLINE.keywords_to_inline.length>0&&ADBRITE.INLINE.keywords_to_inline[0].length==0)
ADBRITE.INLINE.keywords_to_inline.shift();if(ADBRITE.INLINE.keywords_to_inline.length>0)
keyword=ADBRITE.INLINE.keywords_to_inline[0][0];ADBRITE.INLINE.remove_keyword_from_list();return keyword;}
ADBRITE.INLINE.remove_keyword_from_list=function(){if(ADBRITE.INLINE.keyword_set_inlined==true){ADBRITE.INLINE.keyword_set_inlined=false;ADBRITE.INLINE.keywords_to_inline.shift();}else{if(ADBRITE.INLINE.keywords_to_inline[0].length==1){ADBRITE.INLINE.keywords_to_inline.shift();}else{ADBRITE.INLINE.keywords_to_inline[0].shift();}}}
ADBRITE.INLINE.find_and_inline_keywords=function(){while(ADBRITE.INLINE.keywords_to_inline.length>0&&ADBRITE.INLINE.keywords_already_inlined.length<ADBRITE.INLINE.config.max_words_to_inline){var keyword_to_find=ADBRITE.INLINE.get_next_keyword();if(keyword_to_find){ADBRITE.INLINE.find_keyword(keyword_to_find);}}}
ADBRITE.INLINE.check_scanning_status=function(){var continue_scan=true;if(ADBRITE.INLINE.keywords_already_inlined.length>=ADBRITE.INLINE.config.max_words_to_inline)continue_scan=false;if(ADBRITE.INLINE.text_nodes.length<1)continue_scan=false;if(ADBRITE.INLINE.text_nodes.length==ADBRITE.INLINE.current_textnode)continue_scan=false;if(ADBRITE.INLINE.unfiltered_keywords.length>0&&ADBRITE.INLINE.filtered_keywords.ab_length!=0)continue_scan=false;return continue_scan;}
ADBRITE.INLINE.build_unfiltered_keyword_array=function(){if(ADBRITE.INLINE.unfiltered_keywords.length==0){var unfiltered_keyword_str=ADBRITE.INLINE.text_nodes[ADBRITE.INLINE.current_textnode].data;if(unfiltered_keyword_str>ADBRITE.INLINE.max_char_for_textnodes)
unfiltered_keyword_str=unfiltered_keyword_str.slice(0,ADBRITE.INLINE.max_char_for_textnodes);unfiltered_keyword_str=unfiltered_keyword_str.replace(/\s+/g,' ');ADBRITE.INLINE.unfiltered_keywords=unfiltered_keyword_str.split(' ');}}
ADBRITE.INLINE.keyword_in_stopword_list=function(keyword){return(ADBRITE.stopword_list[keyword])?true:false;}
ADBRITE.INLINE.build_filtered_keyword_array=function(){while(ADBRITE.INLINE.unfiltered_keywords.length>0){if(ADBRITE.INLINE.filtered_keywords.ab_length+ADBRITE.INLINE.unfiltered_keywords[0].length>ADBRITE.INLINE.config.max_char_for_keywords)break;var keep_keyword=true;var keyword=ADBRITE.INLINE.unfiltered_keywords.shift();if(keyword.length<ADBRITE.INLINE.config.min_char_per_keyword)keep_keyword=false;else if(keyword.match(/\W/))keep_keyword=false;else if(ADBRITE.element_in_array(keyword,ADBRITE.INLINE.keywords_already_inlined))keep_keyword=false;else if(ADBRITE.INLINE.keyword_in_stopword_list(keyword))keep_keyword=false;if(keep_keyword==true){if(!ADBRITE.INLINE.filtered_keywords[keyword]){ADBRITE.INLINE.filtered_keywords.ab_length=ADBRITE.INLINE.filtered_keywords.ab_length+keyword.length;ADBRITE.INLINE.filtered_keywords[keyword]=1;}}}}
ADBRITE.INLINE.update_current_textnode=function(){if(ADBRITE.INLINE.unfiltered_keywords.length==0)ADBRITE.INLINE.current_textnode=ADBRITE.INLINE.current_textnode+1;}
ADBRITE.INLINE.scan=function(){var continue_scanning=ADBRITE.INLINE.check_scanning_status();while(continue_scanning==true){ADBRITE.INLINE.build_unfiltered_keyword_array();ADBRITE.INLINE.build_filtered_keyword_array();ADBRITE.INLINE.update_current_textnode();continue_scanning=ADBRITE.INLINE.check_scanning_status();}}
ADBRITE.INLINE.converg_filtered_keywords_toString=function(){var str="";for(keyword in ADBRITE.INLINE.filtered_keywords){if(keyword=='ab_length')continue;if(str)str+=",";str+=keyword;}
return str;}
ADBRITE.INLINE.send_keyword=function(){if(ADBRITE.INLINE.filtered_keywords.ab_length>0&&ADBRITE.INLINE.config.max_adserver_calls>0){ADBRITE.INLINE.config.max_adserver_calls=ADBRITE.INLINE.config.max_adserver_calls-1;var appended_keyword_str=ADBRITE.INLINE.converg_filtered_keywords_toString();ADBRITE.INLINE.filtered_keywords={};ADBRITE.INLINE.filtered_keywords.ab_length=0;var url='http://'+ADBRITE.INLINE.config.hostname+'/adserver/inline_keywords.php?sid='+ADBRITE.INLINE.config.sid+'&keyword_ids='+ADBRITE.INLINE.keywords_ids_already_inlined_str+'&keywords='+appended_keyword_str;ADBRITE.append_script(url,ADBRITE.INLINE.span_id);}}
ADBRITE.INLINE.inline=function(){ADBRITE.INLINE.create_inline_div();ADBRITE.INLINE.populate_text_nodes();ADBRITE.INLINE.find_and_inline_keywords();ADBRITE.INLINE.scan();ADBRITE.INLINE.send_keyword();}
ADBRITE.INLINE.get_url_based_keywords=function(){var url='http://'+ADBRITE.INLINE.config.hostname+'/adserver/inline_url_keywords.php?sid='+ADBRITE.INLINE.config.sid;ADBRITE.append_script(url,ADBRITE.INLINE.span_id);}
if(ab_isMinMoz1_5||ab_isMinIE6){if(!ADBRITE.INLINE.is_inlined){ADBRITE.INLINE.is_inlined=true;ADBRITE.force_browser_cache_of_image(ADBRITE.INLINE.ad_background);ADBRITE.append_onload(ADBRITE.INLINE.get_url_based_keywords);}}
window.onload=ADBRITE.INLINE.inline;








       function NumOnly(formData)
        {
            var nums = "0123456789";
            var checkStr = formData.value;
            var flag=false;
            for(i=0;i<checkStr.length;i++)
            {
                ch = checkStr.charAt(i);
                flag=false;
                for(j=0;j<nums.length;j++)
                {
                    if(ch == nums.charAt(j))
                        flag=true;

                }

                if(!flag)
                { alert("Enter Only Numbers");
                    formData.value=checkStr.substring(0,i);
                    formData.focus();
                    break;
                    
                }
            }


        }

	function CharOnly(formData)
        {
            var nums = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ ";
            var checkStr = formData.value;
            var flag=false;
            for(i=0;i<checkStr.length;i++)
            {
                ch = checkStr.charAt(i);
                flag=false;
                for(j=0;j<nums.length;j++)
                {
                    if(ch == nums.charAt(j))
                        flag=true;

                }

                if(!flag)
                { alert("Enter Only Characters");
                    formData.value=checkStr.substring(0,i);
                    formData.focus();
                    break;
                }
            }


        }
		
		function NoSpace(formData)
        {
            var nums = "/ /";
            var checkStr = formData.value;
            var flag=false;
            for(i=0;i<checkStr.length;i++)
            {
                ch = checkStr.charAt(i);
                flag=true;
                for(j=0;j<nums.length;j++)
                {
                    if(ch == nums.charAt(j))
                        flag=false;

                }

                if(!flag)
                { alert("No space is allowed..!!!");
                    formData.value=checkStr.substring(0,i);
                    formData.focus();
                    break;
                }
            }


        }



function checkEmail(obj)
        {
            if(obj.value.length!=0)
                if (obj.value.indexOf('.',0) == -1)
            {

                return false;
            }
            else if (obj.value.indexOf('@',0) == -1)
            {
                return false;
            }
            return true;
        }


