function QuickSearch(SiteUrl)
{
	
	for(i=0; i<document.frmSearch.searchType.length;i++)
	{
		if(document.frmSearch.searchType.value=="photo")
		{
			document.frmSearch.action=SiteUrl+"/search/photo/index.php";
		}
		else if(document.frmSearch.searchType.value=="video")
		{
			document.frmSearch.action=SiteUrl+"/search/video/index.php";
		}
		else if(document.frmSearch.searchType.value=="member")
		{
			document.frmSearch.action=SiteUrl+"/search/member/index.php";
		}

	}
	document.frmSearch.submit();
	return true;
}

	function LoginfrmOnSubmt()
	{
		var LoginName=document.frmlogin.mtxtUserName.value.length;
		var Password=document.frmlogin.mtxtPassword.value.length;
		if(LoginName<=0)
		{
		alert('Please enter username');
		document.frmlogin.mtxtUserName.focus()
		return false;
		}
		if(Password<=0){
		alert('Please enter password');
		document.frmlogin.mtxtPassword.focus()
		return false;
		}
	}
	
/* action div related function start */
var btnclick=false;
if(document.body)
	document.body.onclick=bodyaction;

function showdiv(divname)
{
		var temp;
        temp = document.getElementsByTagName("DIV");
        for(i=0;i<temp.length;i++)
        {
                if(temp[i].id.indexOf("d")==0)
                        temp[i].style.display="none";
        }
        document.getElementById(divname).style.display="block";
}

function bodyaction()
{
        if(!btnclick)
        {
                var temp=document.getElementsByTagName("DIV");
                for(i=0;i<temp.length;i++)
                {
                        if(temp[i].id.indexOf("d")==0)
                                temp[i].style.display="none";
                }
        }
        else
        {
                btnclick=false;
        }
}
function hidediv(divname)
{
        document.getElementById(divname).style.display="none";
}

function tdover(tdname)
{
        if(document.getElementById(tdname).className!="drpMenuTDBorderHover")
                document.getElementById(tdname).className="drpMenuTDBorderHover";
}
function tdout(tdname)
{
        if(document.getElementById(tdname).className!="drpMenuTDBorder")
                document.getElementById(tdname).className="drpMenuTDBorder";
}
////////////////////////////////////////////////////////////////////////////////////////////////
function getposition(ImageId,divId)
{
         // alert(ImageId);
         // alert(divId);
        //alert(document.getElementById(imageid).offsetLeft);
        var imageid = document.getElementById(ImageId);
        objMenuDiv =  document.getElementById(divId);
        x = moveXbySlicePos (0, imageid, divId);
        //alert(x);
        y = moveYbySlicePos (18, imageid);
        document.getElementById(divId).style.top = y;
        document.getElementById(divId).style.left = x;
        showdiv(divId);

}

function moveXbySlicePos (x, img, divId)
{
        var leftside = 65;
        if (!document.layers)
        {
                var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
                var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
                var par = img;
                var lastOffset = 0;
                while(par)
                {
                        if( par.leftMargin && ! onWindows ) x += parseInt(par.leftMargin);
                        if( (par.offsetLeft != lastOffset) && par.offsetLeft ) x += parseInt(par.offsetLeft);
                        if( par.offsetLeft != 0 ) lastOffset = par.offsetLeft;
                        par = macIE45 ? par.parentElement : par.offsetParent;
                }
     }

         else if (img.x) x += img.x;

         if(parseInt(document.getElementById(divId).style.width) + x > (document.body.clientWidth))
                 x= x-leftside;
        return x;
}
function moveYbySlicePos (y, img)
{
        if(!document.layers) {
                var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
                var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
                var par = img;
                var lastOffset = 0;
                while(par){
                        if( par.topMargin && !onWindows ) y += parseInt(par.topMargin);
                        if( (par.offsetTop != lastOffset) && par.offsetTop ) y += parseInt(par.offsetTop);
                        if( par.offsetTop != 0 ) lastOffset = par.offsetTop;
                        par = macIE45 ? par.parentElement : par.offsetParent;
                }
        } else if (img.y >= 0) y += img.y;
        return y;
}

/* Following And above functions are same except the message displays is changed */

function ComapreDates2(txtAuctionSDate, txtAuctionEDate, Caption1, Caption2, focusElement, IsFocus)
 {

    // Pass IsFocus='No' if you don't want to focus on any element
	// focusElement is the control on which will have focus after alert
	// txtAuctionSDate is the object of first date
	// txtAuctionEDate is the object of end date

			if(IsFocus==null) IsFocus = 'Yes';

		          if(txtAuctionSDate.value.length!=0 && txtAuctionEDate.value.length!=0 )
                        {
                          var StartDate = txtAuctionSDate.value;
                          var EndDate = txtAuctionEDate.value;

                          var arrStart = StartDate.split("/");
                          var arrEnd = EndDate.split("/");

                          if(arrEnd[2]<arrStart[2])
                                {
                                 alert( Caption2 + ' must be greater than ' + Caption1 + '.' );

								 /* if focus is shown or not */
                                  if(IsFocus=='Yes')
									 {
										if(focusElement==null) focusElement = txtAuctionEDate.focus();
										else { focusElement.focus();}
									 }

                                  return false;
                                }
                          else if(arrEnd[2]==arrStart[2])
                                {
                                  	if(parseInt(arrEnd[0])<parseInt(arrStart[0]))
                                    {
                                         alert( Caption2 + ' must be greater than ' + Caption1 + '.' );

										 /* if focus is shown or not */
                                         if(IsFocus=='Yes')
											 {
												if(focusElement==null) focusElement = txtAuctionEDate.focus();
												else { focusElement.focus();}
											 }

                                          return false;
                                    }
                                  	else if(parseInt(arrEnd[0])==parseInt(arrStart[0]))
                                    {
                                          if(parseInt(arrEnd[1])<parseInt(arrStart[1]))
                                                {
                                                alert( Caption2 + ' must be greater than ' + Caption1 + '.' );

												   /* if focus is shown or not */
												   if(IsFocus=='Yes')
													 {
														if(focusElement==null) focusElement = txtAuctionEDate.focus();
														else { focusElement.focus();}
													 }

                                                 return false;
                                                }
										else return true;
                                     }
									else return true;

                                }
							else return true;
	                    }
                else
                        {
                                return true;
                        }
}
/* action div related function end */
function date_compare(start_date,end_date)
{
        //alert(start_date +"-----"+ end_date);
        var stdate=start_date.split("-");
        var enddate=end_date.split("-");

        var stmillsec=Date.UTC(parseInt(stdate[0]),parseInt(stdate[1],10),parseInt(stdate[2],10));
        var enmillsec=Date.UTC(parseInt(enddate[0]),parseInt(enddate[1],10),parseInt(enddate[2],10));


        //alert(enddate[1] +"####"+ parseInt(enddate[1],10));
        //alert(parseInt(stdate[0])+","+parseInt(stdate[1],10)+","+parseInt(stdate[2],10)+"@@@@@@@"+parseInt(enddate[0])+","+parseInt(enddate[1],10)+","+parseInt(enddate[2],10));
        //alert(stmillsec +"-----"+ enmillsec );
        if(stmillsec < enmillsec)
        {
                //alert(stmillsec +"-----"+ enmillsec +"false");
                return false;
        }
        else
        {
                //alert(stmillsec +"-----"+ enmillsec +"true");
                return true;
        }
}

function Resize(imgPreview)
{
        var nwidth=imgPreview.width+50;
        var nheight=imgPreview.height+200;
        if(nwidth<200)
                nwidth=200;
        if(nheight<200)
                nheight=200;

        window.resizeTo(nwidth,nheight);
}// JavaScript Document


function go(id)
{
	if(confirm('Are you sure you want to delete the selected item?'))
	{
		document.frmusergroup.delids.value = id;
		return true;
		//onClick="return MultiDelete(\''.$_SESSION['goToUrl'].'\');"
		//document.frmusergroup.submit();
	}

}

function CheckIsSelected(formName,checkBoxName,hiddenName,msg)
{
        var obj=eval("document."+formName);
                var chkobj=eval("document."+formName+"."+checkBoxName);
                var hidobj=eval("document."+formName+"."+hiddenName);
                var blSelected = false;

                if(!chkobj.length)
                {
                        if(chkobj.checked)
                                blSelected = true;
                }
                else
                {
                        for(i=0;i<chkobj.length;i++)
                        {
                                if(chkobj[i].checked)
                                {
                                                blSelected = true;
                                                break;
                                }

                        }
                }

                if(!blSelected)
        {
            if(msg)
                                alert(msg);
                        else
                                alert('Please Select at least one record.');
            return false
        }
                else
                {
                        var values="";
                        if(!chkobj.length)
                        {
                                hidobj.value=chkobj.value
                        }
                        else
                        {
                                for(i=0;i<chkobj.length;i++)
                                {
                                        if(chkobj[i].checked)
                                                values = values+chkobj[i].value+",";
                                }
                                hidobj.value=values.substring(0,values.length -1);
                        }

                        //alert(hidobj.value);
                        return true;
                }
}

function SelectAll(formName,selChkName,checkBoxName)
{
        var selchkobj=eval("document."+formName+"."+selChkName);
                var chkobj=eval("document."+formName+"."+checkBoxName);
        if(selchkobj.checked)
                {
                        if(!chkobj.length)
                        {
                                chkobj.checked = true;
                        }
                        else
                        {
                                for(i=0;i<chkobj.length;i++)
                                {
                                        if(chkobj[i].disabled == false)
                                        chkobj[i].checked = true;
                                }
                        }
                }
                else
                {
                        if(!chkobj.length)
                        {
                                chkobj.checked = false;
                        }
                        else
                        {
                                for(i=0;i<chkobj.length;i++)
                                {
                                        chkobj[i].checked = false;
                                }
                        }
                }
}


function MainSelCheck(formName,selChkName,checkBoxName,index)
{
        var selchkobj=eval("document."+formName+"."+selChkName);
        var chkobj=eval("document."+formName+"."+checkBoxName);
        if(chkobj.length)
        {
                var tmp=eval("document."+formName+"."+checkBoxName+"["+index+"]");
                if(tmp.checked)
                {
                        var selall=true;
                        for(i=0;i<chkobj.length;i++)
                        {
                                if(chkobj[i].checked == false && chkobj[i].disabled == false)
                                {
                                        selall=false;
                                        break;
                                }
                        }
                        if(selall)
                                selchkobj.checked=true;
                        else
                                selchkobj.checked=false;
                }
                else
                {
                        selchkobj.checked=false;
                }
                return true;
        }
        else
        {
                if(chkobj.checked)
                        selchkobj.checked=true;
                else
                        selchkobj.checked=false;
        }

        return true;

}
function ImageWindow(imageUrl)
{
        imWindow = window.open("", "tinyWindow", 'toolbar=0,width=550,height=500,scrollbars=yes,resizable=yes')
        html="<html><head><title>View Image</title><body width=100% height=100%>";
        html+="<style type='text/css'><!--";
        html+=".style1 {BORDER-RIGHT: 1px groove #4EACEC; BORDER-TOP: 1px groove #2F688E; FONT-WEIGHT: bold; FONT-SIZE: 10px; BORDER-LEFT: 1px groove #2F688E; COLOR: #ffffff; BORDER-BOTTOM: 1px groove #4EACEC; FONT-FAMILY: Verdana; BACKGROUND-COLOR: #489FDA}";
        html+="--></style>";
        html+="<table align=center width='100%' height='90%'><tr><td align=center valign=middle>";
        html+="<img src='" + imageUrl + "'>";
        html+="</td></tr></table>";
        html+="<p align=center><input type=button value='Close' onclick='window.close()' class='style1'></p>";
        html+="</body></html>";
        imWindow.document.write(html);
}
function ComapreDates(txtAuctionSDate, txtAuctionEDate, Caption1, Caption2, focusElement, IsFocus)
 {

    // Pass IsFocus='No' if you don't want to focus on any element
	// focusElement is the control on which will have focus after alert
	// txtAuctionSDate is the object of first date
	// txtAuctionEDate is the object of end date


			if(IsFocus==null) IsFocus = 'Yes';

		          if(txtAuctionSDate.value.length!=0 && txtAuctionEDate.value.length!=0 )
                        {
                          var StartDate = txtAuctionSDate.value;
                          var EndDate = txtAuctionEDate.value;

                          var arrStart = StartDate.split("/");
                          var arrEnd = EndDate.split("/");

                          if(arrEnd[2]<arrStart[2])
                                {
                                 alert( Caption1 + ' must be smaller than ' + Caption2 + '.' );

								 /* if focus is shown or not */
                                  if(IsFocus=='Yes')
									 {
										if(focusElement==null) focusElement = txtAuctionEDate.focus();
										else { focusElement.focus();}
									 }

                                  return false;
                                }
                          else if(arrEnd[2]==arrStart[2])
                                {
                                  	if(parseInt(arrEnd[0])<parseInt(arrStart[0]))
                                    {
                                         alert( Caption1 + ' must be smaller than ' + Caption2 + '.' );

										 /* if focus is shown or not */
                                         if(IsFocus=='Yes')
											 {
												if(focusElement==null) focusElement = txtAuctionEDate.focus();
												else { focusElement.focus();}
											 }

                                          return false;
                                    }
                                  	else if(parseInt(arrEnd[0])==parseInt(arrStart[0]))
                                    {
                                          if(parseInt(arrEnd[1])<parseInt(arrStart[1]))
                                                {
                                                alert( Caption1 + ' must be smaller than ' + Caption2 + '.' );

												   /* if focus is shown or not */
												   if(IsFocus=='Yes')
													 {
														if(focusElement==null) focusElement = txtAuctionEDate.focus();
														else { focusElement.focus();}
													 }

                                                 return false;
                                                }
										else return true;
                                     }
									else return true;

                                }
							else return true;
	                    }
                else
                        {
                                return true;
                        }
}
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}
	