//var siteUrl = 'http://localhost/pictures_india/main_application/';
//var sitePath = 'c:/wamp/www/pictures_india/main_application/';

var siteUrl = 'http://www.picturesindia.com/';
//var sitePath = '/home/picture/public_html/';

function topHeader_old()
{
	document.write('<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0"  class="ctop"><tr><td width="16%" align="right"><table width="100%"  border="0" cellspacing="0" cellpadding="0" ><tr><td align=center valign=top class="ctop2">The Real India</td></tr><tr><td><img src="'+siteUrl+'images/logo.jpg"  alt=""></tr></table>		</td>		<td width="84%" valign="top" style="padding-top:5px; "><table width="100%"  border="0" cellspacing="0" cellpadding="0">		  <tr>		   <td>&nbsp;</td> <td align="right" height="20" class="topiso" ><a href="http://www.infobase.co.in/about-us/quality-policy.html" class="topiso"><br /><br /></a></td>      </tr>      <tr>        <td colspan="2"><table width="100%"  border="0" cellspacing="0" cellpadding="0">          <tr>            <td align="center" class="tomorrow" style="padding-left:300px " valign="bottom" colspan="2"></td>				           </tr>          <tr>            <td colspan="2"><table width="100%"  border="0" cellspacing="0" cellpadding="0">              <tr>                <td width="10%" align="center" class="compare">&nbsp;</td>                <td width="90%" valign="top" align="right" class="app-text">The Real India <br>                 <span class="rediso" style="padding-left:40px">&nbsp;</span></td>                              </tr>            </table></td>          </tr>        </table></td>      </tr>    </table></td></tr><tr><td bgcolor=#009B00 colspan=2 height=2></td></tr></table>');
}

function topHeader()
{
	document.write('<table width="1003" border="0" cellpadding="0" cellspacing="0" align="center" valign="top" bgcolor="#ffffff"> <tr> 	<td valign="top" height="68"><table width="100%" height="68" border="0" cellspacing="0" cellpadding="0">   <tr>    <td width="5" bgcolor="#F68220"></td>	          <td background="'+siteUrl+'images/cat-1/th-c-8.jpg" style="background-repeat:repeat-x;">            <table width="100%" border="0" cellspacing="0" cellpadding="0">              <tr>                <td width="330" height="50" align="right"><a href="'+siteUrl+'"><img src="'+siteUrl+'images/pi-logo.jpg" border="0"></a></td>                <td width="309" height="33" align="center" valign="bottom"><!--<img src="'+siteUrl+'images/cat-1/c-01.jpg">--></td>                <td width="400" valign="bottom">								<table width="100%" cellspacing="0" cellpadding="0">	<form name="searchFrm" method="post" action="'+siteUrl+'search.php" onSubmit="return checkSearchForm()">			<tr>                      <td valign="bottom" width="45" height="36"><img src="'+siteUrl+'images/cat-1/c-02.jpg"></td>                      <td class="redhead" width="40">Search</td>					  <td ><input type="text" size="20" maxlength="255" name="skeyword"></td><td>&nbsp;</td><td><select name="match">			<option value="exact">Exact Match</option>			<option value="all">All Words</option>			<option value="any">Any Word</option>		</select></td><td>&nbsp;</td>					  <td width="90" align="left">                        <input type="image" src="'+siteUrl+'images/06.jpg" width="23" height="22">                      </td>				</tr>				</form></table>								</td>				                </tr>            </table>          </td>    <td width="9" align="right"><img src="'+siteUrl+'images/09.jpg"></td>  </tr></table></td> </tr>  <tr> 	<td style="padding-right:45;" height="25" align="right" valign="top" class="top-link" bgcolor="#F0F0F0">	<span class="top-link"><a href="'+siteUrl+'aboutus.html" class="top-link">About Us</a></span>	&nbsp; | &nbsp; <span class="top-link"><a href="'+siteUrl+'contact.html" class="top-link">Contact Us</a></span>	&nbsp; | &nbsp; <span class="top-link"><a href="'+siteUrl+'feedback.php" class="top-link">Feedback Form</a></span>	<!-- &nbsp; | &nbsp; <span class="top-link"><a href="#" class="top-link">Query Form</a></span>	&nbsp; | &nbsp; <span class="top-link"><a href="#" class="top-link">FAQ/Help</a></span>	&nbsp; | &nbsp; <span class="top-link"><a href="#" class="top-link">Accolades</a></span> -->	&nbsp; | &nbsp; <span class="top-link"><a href="'+siteUrl+'download-instructions.html" class="top-link">Download Instructions</a></span>&nbsp; | &nbsp; <span class="top-link2"><a href="'+siteUrl+'the-free-album/" class="toplink1">The Free Album</a></span>	</td> </tr></table>');
}
function footer_old()
{
	document.write('<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0"  class="ctop"><tr><td bgcolor=#009B00 colspan=2 height=2></td></tr>	<tr>    <td height="15" align="right"  class="bottom-line">&nbsp;</td>	</tr>	<tr><td class="copyright grey-bg" height="20"><center><span class="smalltext">©Copyright 2007</span> <a href="http://www.infobase.co.in/" >Compare Infobase Limited</a>. <span class="smalltext">All Rights reserved.</span></center></td></tr>  <tr><td align="center" bgcolor="ffffff">		<table align="center" border="0" cellpadding="2" cellspacing="2" class="smalltext">			<tbody ><tr><td align="left" >US Office </td>				<td align="left" >: US Market Access Centre, 111N Market Street, Suite No.650, 6th floor, San Jose, California. 95113-1101, Phone: +1(408) 351-3379</td>			</tr>			<tr><td align="left" >New Delhi Office </td>				<td align="left" >: C-62, Community Centre, Janakpuri, New Delhi-58 (India),Tel : +91-11-41588012, 25542045, Fax : + 91-11-25547264 </td>			</tr></table>  </td></tr></table>');
}

function footer()
{
	document.write('<table width="1003" border="0" cellpadding="0" cellspacing="0" align="center" valign="top" bgcolor="#ffffff"><tr><td bgcolor="#007B13" height="2"></td></tr><tr><td bgcolor="#F8AE6F" height="2"></td></tr> <tr><td bgcolor="#F6821F" height="10" align="center" class="footer-link"><a href="http://www.picturesindia.com/aboutus.html" class="footer-link">About Us</a> &nbsp;| &nbsp; <a href="http://www.picturesindia.com/disclaimer.html" class="footer-link">Disclaimer</a> &nbsp;| &nbsp; <a href="http://www.picturesindia.com/contact.html" class="footer-link">Contact Us</a></td></tr><tr><td>		<table width="100%" align="center" cellpadding="4" cellspacing="0" border="0">			<tr>          <td width="10%" height="113" align="right" style="padding-right:15px"><a href="http://www.infobase.co.in/"><IMG SRC="'+siteUrl+'images/c-logo.jpg" WIDTH="58" HEIGHT="82" BORDER="0" ALT=""></a></td>				<td width="90%" valign="middle"><span class="footerhead"><a href="http://www.infobase.co.in/" class="footerhead">Compare Infobase Limited</a></span><br><span class="footertext">C-62, Community Center, Janakpuri, New Delhi-58 (India)<br>					Tel : +91-11-41588011, 41588013, 41588014 Fax : + 91-11-25547264 Mobile : +91(0) 9871399016<br>					&copy; Copyright 2000-2007 - Compare Infobase Limited. All Rights Reserved.<br></span></td>			</tr></table>	</td></tr></table></body></html>');
}
				   
function clickEvent()
{
}

function Select_All(frmName,checkBoxName,flag)//Function For Select check box
{
	var frm = eval("document."+frmName);
	var chkObj = frm[checkBoxName];
	var total_records_viewed;

	if(chkObj)
	{
		if(chkObj.length == undefined)
		{
			chkObj.checked = flag;
			//total_records_viewed = 1;
		}
		else
		{
			total_records_viewed = chkObj.length;
	
			for(var i=0;i<total_records_viewed;i=i+1)
			{				
				chkObj[i].checked = flag;
			}
		}
	}
}


function isValidEmail(sFieldValue)
{
	var REmail=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

	var str=sFieldValue;
	if(!str.match(REmail)){
		return false;
	}
	else
	{
		return true;
	}
}

function checkFieldText(fldObj, strtext, iMess)
{
	if(iMess != 0 )
	{
		iMess = 1;
	}
	if (trim(fldObj.value) == "") 
	{
		if(iMess == 1)
		{
			fldObj.focus();
			alert (strtext);
		}
		return false;
	}
	
	return true;
}


function checkField(fldObj, strtext)
{
	if (trim(fldObj.value) == "") 
	{
		fldObj.focus();
		alert (strtext);
		return false;
	}
	
	return true;
}


function checkfornum(str1) 
{
	//This function checks for numeric values
	var numstr="1234567890 ,";
	var intctr,intLen;
	intLen=str1.length;
	for(intCtr=0;intCtr <= intLen && numstr.indexOf(str1.charAt(intCtr))>=0 ;intCtr++);
	if(intCtr > intLen)
	{
		return 1;
	}
	else
	{
		return 0;
	}

}



//////////////
function checkforchar(strdate)
{
	//This function checks for string values
	var validdate = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var strlength = strdate.length;
	for(var i=0; i<=strlength; i++)
	{
		var unitstr = strdate.substr(i,1);
		if (validdate.indexOf(unitstr)==-1)
		{
			return false;
		}
	}
	return true;
}




///////////////////
function trim(str1)
{
	// This function trims any given field value for blank spaces.
	var intCtr=0
	for(intCtr=0;str1.charAt(intCtr)==" ";intCtr++);
	str1=str1.substring(intCtr,str1.length);
	return str1; 
}



function refreshParent()
{
	window.opener.location.href = window.opener.location.href;
	window.opener.location.reload(true);
	if (window.opener.progressWindow)
	{
		window.opener.progressWindow.close();
	}
}

function notyping(obj)  // function to restrict typing in image browing field
{
	if(event.keyCode != 32)
	{
		alert("You can not write in file name directly.\n Please click on Browse");
		obj.blur();
		return false;
	}
	else
	{
		return true;
	}
}

//////////function for maxlength in textarea
function ismaxlength(obj)
{
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : "";

	if (obj.getAttribute && obj.value.length > mlength)
	{
		obj.value = obj.value.substring(0, (mlength-1));
		alert("The maximum character limit ("+ mlength +" characters) has been crossed .");
		return false;
	}
	else
	{
		return true;
	}
}
/*****************changes done on 30Jan 2008 ***********************************/
function action_entry(formName, checkbox, promptName, formAction)
{
	/**	Function selectone() is used to ensure that 
	 *	whether at least one check box exist on the form is checked or not.
	 */

	chk		=	checkField(formName,checkbox);
	
	if(!chk)
	{
		alert("Please check atleast one.");
		
		return false;
	}
	else
	{
		///ask the user for confirmation about the action.
		var agree= confirm("Do you really want to "+ promptName +" ");

		if (agree== true)											///if 'Yes'
		{
			formName.action_mode.value= promptName;	
			formName.action= formAction;						///change the action of the form
			return true;
		}
		else														///if 'No'
		{
			return false ;
		}///end of else if case
	}
	
}///end of function


function checkField(frmName, ChkBoxName)
{
	var objCheck = frmName[ChkBoxName];
	
	if(objCheck == undefined)
	{
		return false;
	}
	else
	{
		myRecpArray = new Array();
		var flag = '';
		if(myRecpArray.length >0)
		{
			myRecpArray = myRecpArray.shift();
		}

		var ct = 0;
		if(objCheck.length == undefined)
		{
			if (objCheck.checked)
			{
				flag = true;
				myRecpArray[ct] = objCheck.value;
				ct++;
				
			}
		}
		else
		{
			myRecpArray = new Array();
			for (i = 0; i < objCheck.length; i++)
			{
				if (objCheck[i].checked)
				{
					flag = true;
					myRecpArray[ct] = objCheck[i].value;
					ct++;
				}
			
			}
			//alert(myRecpArray)
			
		}

		return flag;
	}

}

/**	This  Function checkIt() used for check all other check box 
	existing in form on checking the main checkbox.
*/
function checkIt(frmObj,checkAllObj,checkBoxName) 
{
	
	var objCheck = frmObj[checkBoxName];
	/** if checkbox exist in form */
	if(objCheck)
	{
		/// if main check box is checked.
		if (checkAllObj.checked == true)  
		{
			///if only one check box exist in form.
			if(objCheck.length == undefined)   
			{											
				objCheck.checked = true;								//make that check box as checked
			}
			else
			{
				///if more then one check box exist in form
				for (i = 0; i < objCheck.length; i++)
				{
					objCheck[i].checked = true;					//make all existing check box as checked
				}///end of for loop
			}///end of else if case.
		}///end of if case that check wether main check box is checked or not.
		else														///if main check box is not checked
		{
			///if only one check box exist in form.
			if(objCheck.length == undefined)
			{
				objCheck.checked = false;
			}
			///if more then one check box exist in form
			for (i = 0; i < objCheck.length; i++)
			{
				objCheck[i].checked = false;
			}///end of for loop.
		}///end of else case
	}
}//end of function


/** This function is used in sorting the form according to a field name with particuler order 
 *	sBy is sort by, i.e. whether in ascending or descending
 *	sOrder is sort order, means on which table fields sorting is done
 */
function sort_result(frmName, sBy, sOrder)
{
	var form			= frmName;
	form.sortBy.value	= sBy;	
	form.sortOrder.value= sOrder;
	form.submit();
	return true;

}/// end of function


/** This function goPage() starts
 * It is responsible for specifying limitstart in paging of records while navigating through records 
 */

function goPage(frmName, iPage)
{
	//alert(document.forms[frmName].task_action.value);
	if(!frmName)
	frmName = 'pageForm';

	document.forms[frmName].limitstart.value = iPage;
	document.forms[frmName].submit();
	return true;

}//end of function goPage()

//function to trim the given string
function trimAll(str){
	if(str.length>0)
	{
		var l=0;
		var r=str.length;
		while((ch=str.charAt(l++)) == ' ');
		while((ch=str.charAt(--r)) == ' ');
		return(0>r)?"":str.substring(l-1,r+1);
	}
	return str;
}

/** This function goPage() starts
 * It is responsible for specifying limitstart in paging of records while navigating through records 
 */
 /*
var frmName = 'pageForm';
function goPage(iPage)
{
	document.forms[frmName].limitstart.value = iPage;
	document.forms[frmName].submit();
	return true;

}//end of function goPage()
*/
	function formSubmit(frmName, fAction)
	{
		var form	= frmName;		
		form.action = fAction;
		form.submit();
		return false;
	}

function openwin(fileName,width,height)
{	
	window.open(fileName, 'myWin', 'resizable=yes,toolbar=no, left=0, top=0, location=no,directories=no,status=no,menubar=no,scrollbars=yes, width='+width+', height='+height);
}


function submitListingLimitCombo(frmObj)
{
	frmObj.action = window.location;
	frmObj.submit();
}


	function checkValidGoPagination(objFrm,total_pages,limit_recs)
	{
		
		var theMessage	= "You entered incorrectly or forgot to fill in ::\n";
		var noErrors	= theMessage;
		var focusval	= '';
		var final_val	= '';

		if(objFrm.getPage)
		{
			if(trimAll(objFrm.getPage.value).length<=0)
			{
				theMessage+= "\nPlease enter page number.";
				if(focusval =='')
				{
					focusval = objFrm.getPage;
				}
			}else 
			{
				if(isNaN(objFrm.getPage.value))
				{
					theMessage +="\n Please enter page in numbers." ;
					if(focusval == '')
					{
						focusval = objFrm.getPage;
					}
				}else if((parseInt(objFrm.getPage.value) <= 0))
				{
					theMessage +="\n Page does not exist." ;
					if(focusval == '')
					{
						focusval = objFrm.getPage;
					}
				}else if((objFrm.getPage.value)>total_pages)
				{
					theMessage +="\n Total pages are " + total_pages + ", You can not enter more then this number." ;
					if(focusval == '')
					{
						focusval = objFrm.getPage;
					}
				}
			
			}
		
		}

		if (theMessage == noErrors)
		{
			if((objFrm.getPage.value)<=0)
			{
				final_val = 0;
			}else if((objFrm.getPage.value)>total_pages)
			{
				final_val = total_pages;
			}else
			{
				final_val = objFrm.getPage.value;
			}
			final_val = parseInt(final_val)-1;
			if(final_val==0)
			{
				window.location.href = "index.html";
			}
			else
			{
				window.location.href = "index"+final_val+".html";
			}
//			objFrm.limitstart.value = countLimit(limit_recs,final_val);
//			objFrm.submit();
			return false;
		} 
		else
		{
			alert(theMessage);
			objFrm.getPage.value = '';
			focusval.focus();
			return false;
		}
	}//end function


function checkValidGoPaginationSearch(objFrm,total_pages,limit_recs)
	{
		
		var theMessage	= "You entered incorrectly or forgot to fill in ::\n";
		var noErrors	= theMessage;
		var focusval	= '';
		var final_val	= '';

		if(objFrm.getPage)
		{
			if(trimAll(objFrm.getPage.value).length<=0)
			{
				theMessage+= "\nPlease enter page number.";
				if(focusval =='')
				{
					focusval = objFrm.getPage;
				}
			}else 
			{
				if(isNaN(objFrm.getPage.value))
				{
					theMessage +="\n Please enter page in numbers." ;
					if(focusval == '')
					{
						focusval = objFrm.getPage;
					}
				}else if((parseInt(objFrm.getPage.value) <= 0))
				{
					theMessage +="\n Page does not exist." ;
					if(focusval == '')
					{
						focusval = objFrm.getPage;
					}
				}else if((objFrm.getPage.value)>total_pages)
				{
					theMessage +="\n Total pages are " + total_pages + ", You can not enter more then this number." ;
					if(focusval == '')
					{
						focusval = objFrm.getPage;
					}
				}
			
			}
		
		}

		if (theMessage == noErrors)
		{
			if((objFrm.getPage.value)<=0)
			{
				final_val = 0;
			}else if((objFrm.getPage.value)>total_pages)
			{
				final_val = total_pages;
			}else
			{
				final_val = objFrm.getPage.value;
			}
			
			objFrm.limitstart.value = countLimit(limit_recs,final_val);
			objFrm.submit();
			return false;
		} 
		else
		{
			alert(theMessage);
			objFrm.getPage.value = '';
			focusval.focus();
			return false;
		}
	}//end function

	function countLimit(limit_recs,pageValue)
	{
		limitValue = (limit_recs *  (pageValue-1));
		return limitValue;
	}//end function

	function formSubmitValue(frmName,hiddenValue)
	{		
		frmName.filter_cat_id.value	= hiddenValue;
		frmName.submit();
		return false;
	}//end function

function formImageSubmit(frmName,hiddenValue)
{
	var form					= frmName;
	frmName.img_code.value		= hiddenValue;
	form.submit();
	return true;
}//end function

function formAssignImageSubmit(frmName, fAction,sBy,sOrder,sLimit)
 {
  var form = frmName;
  form.limitstart.value = '';
 
  form.parent_limitstart.value = sLimit;
 
  form.sortBy.value = '';
  form.parent_sortBy.value = sBy;
 

  form.sortOrder.value = '';
  form.parent_sortOrder.value = sOrder;
 
  form.action = fAction;
  form.submit();
  return true;
 }
 

 /* function is used to clear all readio button having have as fld variable */
 function clear_radiobox(frmName,fldName)
 {
  var frm = eval("document."+frmName);
  var chkObj = frm[fldName];
  var total_records_viewed;
  
  if(chkObj)
  {
   if(chkObj.length == undefined)
   {
    chkObj.checked = false;    
   }
   else
   {
    total_records_viewed = chkObj.length;
  
    for(var i=0;i<total_records_viewed;i=i+1)
    {
     chkObj[i].checked = false;
    }
   }
  }
 }
 
 
function getDateObject(strDay, strMonth,strYear)
{
	//This function return a date object after accepting 
	//a date string ans dateseparator as arguments
	var month=parseInt(strMonth)
	var day=parseInt(strDay)
	var year=parseInt(strYear)
	
	//Create Date Object
	dtObject=new Date(year,month,day);	
	return dtObject;
}
