/*
	mediaweb.js v 2.0 2009.06.03;
*/


function AjaxRequest() {
  var req = new Object();
  
  req.timeout = null;
  req.generateUniqueUrl = true;
  req.url = window.location.href;
  req.method = "GET";
  req.async = true;
  req.username = null;
  req.password = null;
  req.parameters = new Object();
  req.requestIndex = AjaxRequest.numAjaxRequests++;
  req.responseReceived = false;
  req.groupName = null;
  req.queryString = "";
  req.responseText = null;
  req.responseXML = null;
  req.status = null;
  req.statusText = null;
  req.aborted = false;
  req.xmlHttpRequest = null;
  req.enctype='application/x-www-form-urlencoded';
  req.onTimeout = null; 
  req.onLoading = null;
  req.onLoaded = null;
  req.onInteractive = null;
  req.onComplete = null;
  req.onSuccess = null;
  req.onError = null;
  req.onGroupBegin = null;
  req.onGroupEnd = null;

req.xmlHttpRequest = AjaxRequest.getXmlHttpRequest();
  if (req.xmlHttpRequest==null) { return null; }
  
  // -------------------------------------------------------
  // Attach the event handlers for the XMLHttpRequest object
  // -------------------------------------------------------
  req.xmlHttpRequest.onreadystatechange = 
  function() {
    if (req==null || req.xmlHttpRequest==null) { return; }
    if (req.xmlHttpRequest.readyState==1) { req.onLoadingInternal(req); }
    if (req.xmlHttpRequest.readyState==2) { req.onLoadedInternal(req); }
    if (req.xmlHttpRequest.readyState==3) { req.onInteractiveInternal(req); }
    if (req.xmlHttpRequest.readyState==4) { req.onCompleteInternal(req); }
  };
  
  // ---------------------------------------------------------------------------
  // Internal event handlers that fire, and in turn fire the user event handlers
  // ---------------------------------------------------------------------------
  req.onLoadingInternalHandled = false;
  req.onLoadedInternalHandled = false;
  req.onInteractiveInternalHandled = false;
  req.onCompleteInternalHandled = false;
  req.onLoadingInternal = 
    function() {
      if (req.onLoadingInternalHandled) { return; }
      AjaxRequest.numActiveAjaxRequests++;
      if (AjaxRequest.numActiveAjaxRequests==1 && typeof(window['AjaxRequestBegin'])=="function") {
        AjaxRequestBegin();
      }
      if (req.groupName!=null) {
        if (typeof(AjaxRequest.numActiveAjaxGroupRequests[req.groupName])=="undefined") {
          AjaxRequest.numActiveAjaxGroupRequests[req.groupName] = 0;
        }
        AjaxRequest.numActiveAjaxGroupRequests[req.groupName]++;
        if (AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==1 && typeof(req.onGroupBegin)=="function") {
          req.onGroupBegin(req.groupName);
        }
      }
      if (typeof(req.onLoading)=="function") {
        req.onLoading(req);
      }
      req.onLoadingInternalHandled = true;
    };
  req.onLoadedInternal = 
    function() {
      if (req.onLoadedInternalHandled) { return; }
      if (typeof(req.onLoaded)=="function") {
        req.onLoaded(req);
      }
      req.onLoadedInternalHandled = true;
    };
  req.onInteractiveInternal = 
    function() {
      if (req.onInteractiveInternalHandled) { return; }
      if (typeof(req.onInteractive)=="function") {
        req.onInteractive(req);
      }
      req.onInteractiveInternalHandled = true;
    };
  req.onCompleteInternal = 
    function() {
      if (req.onCompleteInternalHandled || req.aborted) { return; }
      req.onCompleteInternalHandled = true;
      AjaxRequest.numActiveAjaxRequests--;
      if (AjaxRequest.numActiveAjaxRequests==0 && typeof(window['AjaxRequestEnd'])=="function") {
        AjaxRequestEnd(req.groupName);
      }
      if (req.groupName!=null) {
        AjaxRequest.numActiveAjaxGroupRequests[req.groupName]--;
        if (AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==0 && typeof(req.onGroupEnd)=="function") {
          req.onGroupEnd(req.groupName);
        }
      }
      req.responseReceived = true;
      req.status = req.xmlHttpRequest.status;
      req.statusText = req.xmlHttpRequest.statusText;
      req.responseText = req.xmlHttpRequest.responseText;
      req.responseXML = req.xmlHttpRequest.responseXML;
      if (typeof(req.onComplete)=="function") {
        req.onComplete(req);
      }
      if (req.xmlHttpRequest.status==200 && typeof(req.onSuccess)=="function") {
        req.onSuccess(req);
      }
      else if (typeof(req.onError)=="function") {
        req.onError(req);
      }

      // Clean up so IE doesn't leak memory
      delete req.xmlHttpRequest['onreadystatechange'];
      req.xmlHttpRequest = null;
    };
  req.onTimeoutInternal = 
    function() {
      if (req!=null && req.xmlHttpRequest!=null && !req.onCompleteInternalHandled) {
        req.aborted = true;
        req.xmlHttpRequest.abort();
        AjaxRequest.numActiveAjaxRequests--;
        if (AjaxRequest.numActiveAjaxRequests==0 && typeof(window['AjaxRequestEnd'])=="function") {
          AjaxRequestEnd(req.groupName);
        }
        if (req.groupName!=null) {
          AjaxRequest.numActiveAjaxGroupRequests[req.groupName]--;
          if (AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==0 && typeof(req.onGroupEnd)=="function") {
            req.onGroupEnd(req.groupName);
          }
        }
        if (typeof(req.onTimeout)=="function") {
          req.onTimeout(req);
        }
      delete req.xmlHttpRequest['onreadystatechange'];
      req.xmlHttpRequest = null;
      }
    };

  // ----------------
  // Instance methods
  // ----------------
  req.process = 
    function() {
      if (req.xmlHttpRequest!=null) {
        if (req.generateUniqueUrl && req.method=="GET") {
          req.parameters["AjaxRequestUniqueId"] = new Date().getTime() + "" + req.requestIndex;
        }
        var content = null; 
		if(isubmittype=="file")
				req.enctype='multipart/form-data; boundary=AaB03x';
		if(req.enctype=="multipart/form-data; boundary=AaB03x")
		{
			var boundary = '--AaB03x'; 
			for (var i in req.parameters) { 			
         		req.queryString +=  boundary + '\n' 
				+ 'Content-Disposition: form-data; name="'+encodeURIComponent(i)+'"; '+'\n' 
				+ '\n' + req.parameters[i] + '\n';
			}
			if(isubmittype=="file"){

				var typename = new Array();
				var typename=isubmitvalue.split('.');
				req.queryString += boundary + '\n'  
				+ 'Content-Disposition: form-data; name="'+encodeURIComponent(isubmitname)+'"; filename="' 
				+ isubmitvalue + '"'+'\n'
				+'Content-Type: '+typename[1]+'\n'				
				+ '\n'+'\n'+'hgfh'+'\n'+'\n';
		
			}
  			req.queryString +=boundary;
		 }
		 else
		 {
        	for (var i in req.parameters) {
          		if (req.queryString.length>0) { req.queryString += "&"; }
          		req.queryString += encodeURIComponent(i) + "=" + encodeURIComponent(req.parameters[i]);
        	}
		 }
        if (req.method=="GET") {
          if (req.queryString.length>0) {
            req.url += ((req.url.indexOf("?")>-1)?"&":"?") + req.queryString;
          }
        }
		
        req.xmlHttpRequest.open(req.method,req.url,req.async,req.username,req.password);
        if (req.method=="POST") {
          if (typeof(req.xmlHttpRequest.setRequestHeader)!="undefined") {
            req.xmlHttpRequest.setRequestHeader('Content-type', req.enctype);	
			//alert(req.enctype+req.queryString);
			
          }
          content = req.queryString;
        }
        if (req.timeout>0) {
          setTimeout(req.onTimeoutInternal,req.timeout);
        }
		
        req.xmlHttpRequest.send(content);
      }
    };

  req.handleArguments = 
    function(args) {
      for (var i in args) {
        if (typeof(req[i])=="undefined") {
          req.parameters[i] = args[i];
        }
        else {
          req[i] = args[i];
        }
      }
    };

  req.getAllResponseHeaders =
    function() {
      if (req.xmlHttpRequest!=null) {
        if (req.responseReceived) {
          return req.xmlHttpRequest.getAllResponseHeaders();
        }
        alert("Cannot getAllResponseHeaders because a response has not yet been received");
      }
    };

  req.getResponseHeader =
    function(headerName) {
      if (req.xmlHttpRequest!=null) {
        if (req.responseReceived) {
          return req.xmlHttpRequest.getResponseHeader(headerName);
        }
        alert("Cannot getResponseHeader because a response has not yet been received");
      }
    };

  return req;
}

// ---------------------------------------
// Static methods of the AjaxRequest class
// ---------------------------------------

AjaxRequest.getXmlHttpRequest = function() {
  if (window.XMLHttpRequest) {
    return new XMLHttpRequest();
  }
  else if (window.ActiveXObject) {
      
    try {
      return new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        return new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        return null;
      }
    }
    
  }
  else {
    return null;
  }
};

AjaxRequest.isActive = function() {
  return (AjaxRequest.numActiveAjaxRequests>0);
};

AjaxRequest.get = function(args) {
  AjaxRequest.doRequest("GET",args);
};

AjaxRequest.post = function(args) {
  AjaxRequest.doRequest("POST",args);
};

AjaxRequest.doRequest = function(method,args) {
  if (typeof(args)!="undefined" && args!=null) {
    var myRequest = new AjaxRequest();
    myRequest.method = method;
    myRequest.handleArguments(args);
    myRequest.process();
  }
}  ;

AjaxRequest.submit = function(theform, args) {
  var myRequest = new AjaxRequest();
  if (myRequest==null) { return false; }
  var serializedForm = AjaxRequest.serializeForm(theform);
  myRequest.method = theform.method.toUpperCase();
  myRequest.url = theform.action;
  if(theform.enctype=="multipart/form-data")
  	myRequest.enctype='multipart/form-data; boundary=AaB03x';
  myRequest.handleArguments(args);
  myRequest.queryString = serializedForm;
  myRequest.process();
  return true;
};

AjaxRequest.serializeForm = function(theform) {
  var els = theform.elements;
  var len = els.length;
  var queryString = "";
  var boundary = '--AaB03x'; 
  this.addField = 
    function(name,value,type) { 
	if(theform.enctype=="multipart/form-data" ){
			//req.queryString='';
			if(type=="file") 	
   				queryString += boundary + '\n'  
				+ 'Content-Disposition: file; name="'+encodeURIComponent(name)+'"; filename="' 
				+ value + '"' + '\n'+'\n'+'\n';
			else
				queryString += boundary + '\n'  
				+ 'Content-Disposition: form-data; name="'+encodeURIComponent(name)+'"; '+'\n' 
				+ '\n' + value + '\n';
		}
		else
		{
      if (queryString.length>0) { 
        queryString += "&";
      }
      queryString += encodeURIComponent(name) + "=" + encodeURIComponent(value);
		}
    };
  for (var i=0; i<len; i++) {
    var el = els[i];
    if (!el.disabled) {
      switch(el.type) {
        case 'text': case 'password': case 'hidden': case 'textarea': case 'file':
          this.addField(el.name,el.value,el.type);
          break;
        case 'select-one':
          if (el.selectedIndex>=0) {
            this.addField(el.name,el.options[el.selectedIndex].value,el.type);
          }
          break;
        case 'select-multiple':
          for (var j=0; j<el.options.length; j++) {
            if (el.options[j].selected) {
              this.addField(el.name,el.options[j].value,el.type);
            }
          }
          break;
        case 'checkbox': case 'radio':
          if (el.checked) {
            this.addField(el.name,el.value,el.type);
          }
          break;	
		case 'submit': case 'button':
		  if(el.name==isubmitname && el.value==isubmitvalue && ( isubmittype=="submit" || isubmittype=="button"))
		  	this.addField(el.name,el.value,el.type);
      }
    }
  }
 
  return queryString;
};

// -----------------------
// Static Class variables
// -----------------------

AjaxRequest.numActiveAjaxRequests = 0;
AjaxRequest.numActiveAjaxGroupRequests = new Object();
AjaxRequest.numAjaxRequests = 0;

var isubmitname;
var isubmitvalue;
var isubmittype;

function toconvert(otoutf,oelement)
{
	var sourceareastr = oelement.value;
	var strlen = sourceareastr.length;
	var str="";
	if (otoutf=='wintoutf') { 
		 for (i = 0; i < strlen;  i++) { 
		  	var codestr = sourceareastr.charCodeAt(i);
		   	switch(codestr) {
				case 184: codestr=1105;break; 
				case 168: codestr=1025;break; 
			
				case 175: codestr=1198; break; 
				case 191: codestr=1199; break; 
				
				case 170: codestr=1256; break; 
				case 186: codestr=1257; break; 
		   }
		   if (256>codestr && codestr>191) 
		   		codestr=codestr+848;
		   switch(codestr) {
				case 1111: codestr=1199;break;   
				case 1031: codestr= 1198; break; 
				
				case 1108: codestr=1257; break; 
				case 1028: codestr=1256; break; 
		   }
			   str=str+String.fromCharCode(codestr);
		} 
		
		oelement.value=str;	   	   
	 
	} 
	else 
		if (otoutf=='utftowin') { 
			   for (i = 0; i < strlen;  i++) { 
					var codestr = sourceareastr.charCodeAt(i);
					switch(codestr) {
						case 1025: codestr=168;break; 
						case 1105: codestr=184;break; 
							
						case 1198: codestr=175; break; 
						case 1199: codestr=191; break; 
						
						case 1256: codestr=170; break; 
						case 1257: codestr=186; break; 
						
						case 415: codestr=170; break; 
						case 629: codestr=186; break; 
					}
					if (1280>codestr && codestr>1023) 
							codestr=codestr-848; 
					str=str+String.fromCharCode(codestr);
		   		}
	   			
				oelement.value=str;
	
	   		
        }
		
}

var editorMY=[];

function checkFormConvert(oCheckformId)
{
	var formError=0;
	var Checkform=document.getElementById(oCheckformId);
	var oldElemen;
	if(Checkform)
	{
		inputInd=0;		
		while(Checkform.getElementsByTagName('input')[inputInd])
		{
			
			var testinput=Checkform.getElementsByTagName('input')[inputInd];
			if(testinput.type!='file'){
				toconvert('wintoutf',testinput);
			}	
				
				if (testinput.className.indexOf("im_extvalidEmail")!=-1 ) {
					if(!validateEmail(testinput.id)){
						formError++;
					}
				}
				else
					if (testinput.className.indexOf("im_extvalidREEmail")!=-1 || testinput.className.indexOf("im_extvalidREpass")!=-1 ) {
						if(oldElemen && oldElemen.value!=testinput.value || testinput.value==''){
							if (testinput.className.indexOf("im_extvalidREEmail")!=-1)
								validateInputRE(testinput.id,"im_extvalidREEmail");
							else
								validateInputRE(testinput.id,"im_extvalidREpass");
							formError++;
						}
					}
					else
						if (testinput.className.indexOf("im_extvalid")!=-1 ) {
							if(!validateInput(testinput.id)){
								formError++;						
							}
						}
				
				oldElemen=testinput;
			
			inputInd++;
		}
		
		textareaInd=0;
		while(Checkform.getElementsByTagName('textarea')[textareaInd])
		{			
			var testarea=Checkform.getElementsByTagName('textarea')[textareaInd];						
			toconvert('wintoutf',testarea);	
			
			if (testarea.className.indexOf("im_extvalid")!=-1 ) {
				if(!validateInput(testarea.id)){
					formError++;						
				}
			}
			if(editorMY && editorMY[testarea.id])
				editorMY[testarea.id].loadContentFromField();
			textareaInd++;
		}		
		
		
			selectInd=0;
			while(Checkform.getElementsByTagName('select')[selectInd])
			{			
				var testselect=Checkform.getElementsByTagName('select')[selectInd];						
				
				if (testselect.className.indexOf("im_extvalid")!=-1 ) {
					if(!validateInput(testselect.id)){
						formError++;						
					}
				}
				
				selectInd++;
			}
	}
	//alert(formError);
	if(formError==0)
		return true;
	else	
		return false;
}



	function removescript(oelement){
		
		var fcontainer=document.getElementById(oelement);
		jsind=0;
		var mainbody=document.getElementsByTagName('body')[0];
		while(fcontainer.getElementsByTagName('script')[jsind]){
			var oldscript=fcontainer.getElementsByTagName('script')[jsind];
			if(document.getElementById(oelement+'_'+jsind)){
				var removejs=document.getElementById(oelement+'_'+jsind)
				mainbody.removeChild(removejs);
			}
			jsind++;
		}
		
	}

	function loadscript(oelement){
		
		var fcontainer=document.getElementById(oelement);
		jsind=0;
		var mainbody=document.getElementsByTagName('body')[0];
		while(fcontainer.getElementsByTagName('script')[jsind]){
			var oldscript=fcontainer.getElementsByTagName('script')[jsind];
			
			var newscript=document.createElement('scr'+'ipt');
			newscript.text=oldscript.text;
			newscript.id=oelement+'_'+jsind;
			newscript.type="text/javascript";
			if(oldscript.src)
				newscript.src=oldscript.src;
			
			mainbody.appendChild(newscript);
			jsind++;
		}
	}


	var winW = 800, winH = 600, winOrgW=800, WinOrgH=600, sizeload='no';
	
	function winodowsize(){		
		if (parseInt(navigator.appVersion)>3) 
		{
			 if (navigator.appName=="Netscape") 
			 {
				  winW = window.innerWidth;					 
				  winH = window.innerHeight;
			 }
			else
			 if (navigator.appName.indexOf("Microsoft")!=-1 ) 
			 {
				  winW = document.body.offsetWidth;					  
				  winH = document.body.offsetHeight;
			 }
			else
			 if(window.XMLHttpRequest)
			 {
				if(document.body.offsetHeight)
				 winH = document.body.offsetHeight;
				if(window.innerWidth)
				 winW = window.innerWidth;
			 }
			 
			 if(sizeload=='no'){
				 sizeload='yes';
				 winOrgW=winW;
				 winOrgH=winH;
  			     
				 if(document.getElementById('filebodyTDmainIndex') && winW<1120  && document.getElementById('myLangTD')){
					document.getElementById('filebodyTDmainIndex').style.width='1100px';
				 }
				 else{
					 mDw=winW-20; 
					 if(document.getElementById('filebodyTDmainIndex') && document.getElementById('myLangTD'))
					 document.getElementById('filebodyTDmainIndex').style.width=mDw+'px';
				 }
			 }
		
			
			 if(document.getElementById('sotester2')){
				document.getElementById('sotester2').setAttribute("width",winW);
				document.getElementById('sotester2').setAttribute("height",winH);
			 }
		}
	}

	function getCookie(c_name)
	{
		if (document.cookie.length>0)
		  {
		  c_start=document.cookie.indexOf(c_name + "=");
		  if (c_start!=-1)
			{
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
			}
		  }
		return "";
	}
	
	function setCookie(c_name,value,expiredays)
	{
		if(vsubpath2=='')
			path='/';
		else
			path=vsubpath2;
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +escape(value)+
		((expiredays==null) ? "" : ";expires="+exdate.toGMTString())+
		";path="+path;
	}
	
	var oldsel=[];	
	var lenchcolor1=[];
	var lenchcolor2=[];
	var lenchcolor3=[];
	var disableover=[];
	
	function createMenu(code,class1,class2,class3){
		lenchcolor1[code]=class1;
		lenchcolor2[code]=class2;
		lenchcolor3[code]=class3;
		oldsel[code]=-1;
		oldsel[code+'id']='';
		disableover[code]=[];
		//getCookie(code);
	}
	
	function adddisable(code,id){
		disableover[code][id]='yes';
	}
	
	
	function reqLenFunc(otype,oele,oid,ocode){
		
		if(!disableover[ocode])
			disableover[ocode]=[];
		if(!oele.id){
			oele=document.getElementById(oele);
		}
		
		var jsTRid;
		jsTRid=ocode+oldsel[ocode];
		fspea=oid*1;
		nspea=oid*1+1;
		
		cur_fspea=oldsel[ocode]*1;
		cur_nspea=oldsel[ocode]*1+1;
				
		if(otype=='over'){
		
			if(oele.id!=jsTRid){
					
				if(disableover[ocode][oid]!='yes')	
				oele.className=lenchcolor1[ocode];
				
				if(document.getElementById(ocode+'spea_'+fspea)){
					document.getElementById(ocode+'spea_'+fspea).className=ocode+'spea0_sel';
				}
				if(document.getElementById(ocode+'spea_'+nspea)){
					document.getElementById(ocode+'spea_'+nspea).className=ocode+'spea0_sel';
				}
				
			}
			
			if(oldsel[ocode]!=0){
				if(document.getElementById('over_'+jsTRid)){
					document.getElementById('over_'+jsTRid).style.display='none';
				}
			}
			
			
			if(document.getElementById('over_'+oele.id)){
				document.getElementById('over_'+oele.id).style.display='block';
			}
		}
		
		
		if(otype=='out'){
			
			if( oele.id!=jsTRid){
				if(disableover[ocode][oid]!='yes')
				oele.className=lenchcolor2[ocode];
				if(document.getElementById(ocode+'spea_'+fspea) &&  cur_fspea!=fspea && cur_nspea!=fspea){
					document.getElementById(ocode+'spea_'+fspea).className=ocode+'spea0';
				}
				if(document.getElementById(ocode+'spea_'+nspea) &&  cur_nspea!=nspea && cur_fspea!=nspea){
					document.getElementById(ocode+'spea_'+nspea).className=ocode+'spea0';
				}
				
			}
			
			if(document.getElementById('over_'+oele.id)){
				document.getElementById('over_'+oele.id).style.display='none';
			}	
		}
		
		if(otype=='click' || otype=='click2'){
			
			if(oldsel[ocode]!=0){
				
				if(document.getElementById(jsTRid) && disableover[ocode][oldsel[ocode]]!='yes'){
					document.getElementById(jsTRid).className=lenchcolor2[ocode];
				}
				if(document.getElementById('body_'+jsTRid)){
					document.getElementById('body_'+jsTRid).style.display='none';
				}
			}
			
			if(document.getElementById(ocode+'spea_'+fspea)){
				document.getElementById(ocode+'spea_'+fspea).className=ocode+'spea0_sel';
			}
			if(document.getElementById(ocode+'spea_'+nspea)){
				document.getElementById(ocode+'spea_'+nspea).className=ocode+'spea0_sel';
			}
				
			oldsel[ocode]=oid;

			//setCookie(ocode,oid,1);
			//setCookie(ocode,oid,1);			
			//alert(disableover[ocode][oid]+'***'+oldsel[ocode]+'*****'+oid);
			if(disableover[ocode][oid]!='yes')
			oele.className=lenchcolor3[ocode];
			if(otype=='click2' && oele.getElementsByTagName('a')[0]){
				var ahref=oele.getElementsByTagName('a')[0].href;
				
				if(ahref.split('javascript')!=-1){
					
					window.location.href=ahref;
				}
			}
			
			if(document.getElementById('body_'+oele.id)){
				document.getElementById('body_'+oele.id).style.display='block';
			}

		}
		
	}
	
	createMenu('mmenumain_','mmenu_itemon','mmenu_itemoff','mmenu_itemon');
	createMenu('mmenumain2_','mmenu_itemon2','mmenu_itemoff2','mmenu_itemon2');
	createMenu('mmenumain3_','mmenu_itemon3','mmenu_itemoff3','mmenu_itemon3');
	createMenu('pbot_','pb_itemon','pb_itemoff','pb_itemon');
	createMenu('htab_','dn_tabTopBarItem','dn_tabTopBarItem2','dn_tabTopBarItem');
	createMenu('htab2_','dn_tabTopBarItem','dn_tabTopBarItem2','dn_tabTopBarItem');
	createMenu('hscroll_','dn_scrollItem','dn_scrollItem2','dn_scrollItem');
	
	var oldTopMenuSel=0;
	function leftNewsMenuClick(oclick){
		
		if(document.getElementById('MenuHLeftMedia_li_'+oldTopMenuSel+'_sub')){
			document.getElementById('MenuHLeftMedia_li_'+oldTopMenuSel+'_sub').className='my_MenuHLeftMedia_item1_sub1';
		}
		
		if(document.getElementById('MenuHLeftMedia_li_'+oclick+'_sub')){
			document.getElementById('MenuHLeftMedia_li_'+oclick+'_sub').className='my_MenuHLeftMedia_item1_sub1-sel';
		}
		oldTopMenuSel=oclick;
	}
	
	
	function ajaxpage(url, containerid)
	{
	
		var loadDivId='',urlOrg=url;
		if(document.getElementById(containerid+'_load'))
			loadDivId=containerid+'_load';
		else
			loadDivId=containerid;
		/**/	
		var loadHTML='<table width="16" height="16"><tr><td align="center"><a href="javascript:void(0)" style="font-size:11px;" onclick="ajaxpage(\''+url+'\', \''+containerid+'\')" /><img src="'+vsubpath+'/isimage/spinner.gif" border="0" width="16" height="16" align=absmiddle></a></td></tr></table>';	
		url=url+"&isajax=true"
		osendP=url.split('?');
		
		var isendf=[];
		expo1=osendP[1].split('&');
		for (k=0;k<expo1.length;k++) 
		{
			expo2=expo1[k].split('=');
			isendf[expo2[0]]=expo2[1];
		} 

		AjaxRequest.post(
		  {
			 'parameters':isendf 
			,'url':osendP[0]
			,'onLoading':function(req){ document.getElementById(loadDivId).innerHTML = loadHTML; }
			,'onLoaded':function(req){ document.getElementById(loadDivId).innerHTML = loadHTML;  }
			,'onInteractive':function(req){ 
				document.getElementById(loadDivId).innerHTML = loadHTML; 				
				//loadpage(req, containerid);			
			}
			,'onSuccess':function(req){ 
				
					loadpage(req, containerid);
			}
			,'onError':function(req){ 
				//alert(url+' Error!\nStatusText='+req.statusText+'\nContents='+req.responseText+'<br>');
					//document.getElementById(loadDivId).innerHTML = ''; 
					ajaxpage(urlOrg, containerid);
				}
		  });
	}
	
	function loadpage(page_request, containerid) {
	
			document.getElementById(containerid).innerHTML = page_request.responseText;
			removescript(containerid);
			loadscript(containerid);
			
	}
	
	
	function trim(stringToTrim) {
		return stringToTrim.replace(/^\s+|\s+$/g,"");
	}
	function ltrim(stringToTrim) {
		return stringToTrim.replace(/^\s+/,"");
	}
	function rtrim(stringToTrim) {
		return stringToTrim.replace(/\s+$/,"");
	}


	function validateEmail(email) {
	   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	   //var address = document.forms[form_id].elements[email].value;
	   var address = document.getElementById(email);
	    var address2 = trim(document.getElementById(email).value);
		
		
	   if(reg.test(address2) == false) {
		  //alert('Invalid Email Address');		  
		  address.className='im_extvalidEmail im_errorValid';
		  return false;
	   }
	   else{
		   address.className='im_extvalidEmail';
		   document.getElementById(email).value=address2;
	   	   return true;
	   }
	}
	
	function validateInputRE(oid,oclass){
		var address = document.getElementById(oid);
		address.className=oclass+' im_errorValid';
	}
	
	function validateEmailImg(email,email2){
		if(validateEmail(email))
			document.getElementById(email2).innerHTML="<img src='"+vsubpath+"/isimage/Tick.png' border=0 width=16 height=16 />"; 
		else 
			document.getElementById(email2).innerHTML="<img src='"+vsubpath+"/isimage/Delete.png' border=0 width=16 height=16 />";	
	}
	
	function validateEmailImg2(email,email2,email1){
		
		if(validateEmail(email1)){
		
			if(document.getElementById(email1).value==document.getElementById(email).value)
				document.getElementById(email2).innerHTML="<img src='"+vsubpath+"/isimage/Tick.png' border=0 width=16 height=16 />"; 
			else
				document.getElementById(email2).innerHTML="<img src='"+vsubpath+"/isimage/Delete.png' border=0 width=16 height=16 />";
		}
		else 
			document.getElementById(email2).innerHTML="<img src='"+vsubpath+"/isimage/Delete.png' border=0 width=16 height=16 />";	
	}
	
	function validateInput(email) {
	   
	   var address = document.getElementById(email);
	   
	   if(address.value=='') {
		  address.className='im_extvalid im_errorValid'; 
		  return false;
	   }
	   else{
		 address.className='im_extvalid'; 
	   	  return true;
	   }
	}
	
	 function overBannerLink(id) {
		for (var i = 1; i <= 5 ; i++) {
		  if(document.getElementById("bannerLinkA" + i)){			
			  if (i == id) {
				document.getElementById("bannerLinkA" + i).className = "selected";
				document.getElementById("banner" + i).className = "";
			  } else {
				document.getElementById("bannerLinkA" + i).className = "";
				document.getElementById("banner" + i).className = "hide";
			  }
		  }
		}
	  }
	  
	  
	  function PrintpageWin(theURL) {
		
		window.open(theURL, '', 'scrollbars=yes,toolbar=No,location=No,directories=No,menubar=yes,status=No,titlebar=No,resizable=no,width=1000,height=800');
	}


     var hb2slideE='';
	 
	 function hn2main(oid){
		 if(hb2slideE!='' && document.getElementById(hb2slideE) && hb2slideE!=oid){
		 	document.getElementById(hb2slideE).style.display='none';
		
		 if(hb2slideE!='' && document.getElementById(oid))
		 	document.getElementById(oid).style.display='block';
		hb2slideE=oid;
		 }
	 }
	 
	  var hb2slideE2='';
	 
	 function hn2main2(oid){
		 if(hb2slideE2!='' && document.getElementById(hb2slideE2)  && hb2slideE2!=oid){
		 	document.getElementById(hb2slideE2).style.display='none';
		
		 	if(hb2slideE2!='' && document.getElementById(oid))
		 		document.getElementById(oid).style.display='block';
			hb2slideE2=oid;
		 }
	 }
	 
	
	var inetMpVpCurPage = [];
	var inetMpVpLastPage = [];
	var inetMpVpLastType = [];
	var inetMpVpLock = [];

	var MpVpNum=[];
	var MpVpWidth=[];
	var MpVpTitleWidth=[];
	var MpVpimg=[];
	var MpVpNew=[];
	var inetMpVpTitleHeight = [];
	var MpPrev=[];
	var MpNext=[];
	var MpStartLeft=[];

	var showpageN='';
	
	function inetSliderInit(code,width,imgnum,index,height,bg,left,width2){
		MpVpWidth[code]=width*1;
		MpVpTitleWidth[code]=width2*1;
		MpVpNum[code]=imgnum*1;	
		MpVpimg[code]=imgnum*1;
		inetMpVpCurPage[code] = index*1;
		inetMpVpLastPage[code] = 0;
		inetMpVpLastType[code] = 'left';
		inetMpVpLock[code] = false;
		inetMpVpTitleHeight[code] = height*1;
		MpVpNew[code]=bg;
		MpPrev[code]=[];
		MpNext[code]=[];
		MpStartLeft[code]=left;
	}
	
	function inetMpVpBlur( lnk ) {
		try {
			lnk.blur();
		} catch(e) {};
	}
	
	function inetMpVpNext( lnk , code) {
		inetMpVpBlur( lnk );
		if((inetMpVpCurPage[code] < MpVpNum[code])&&(!inetMpVpLock[code])) {
			inetMpVpSlideLeft(code);
		}
		else{
			if((inetMpVpCurPage[code] == MpVpNum[code])&&(!inetMpVpLock[code])) {
				inetMpVpPage(1,document.getElementById('inetMpVid'+code+'ADot1'),code);
			}
		}
	}
	
	function inetMpVpPrev( lnk , code) {
		inetMpVpBlur( lnk );
	
		if((inetMpVpCurPage[code] > 1)&&(!inetMpVpLock[code])) {
			inetMpVpSlideRight(code);	
		}
		else
			if((inetMpVpCurPage[code] == 1)&&(!inetMpVpLock[code])) {
				inetMpVpPage(MpVpNum[code],document.getElementById('inetMpVid'+code+'ADot1'),code);	
			}
	}

	function inetMpVpPage( intPage, lnk , code) {
		
		inetMpVpBlur( lnk );
	
		if((inetMpVpCurPage[code] != intPage)&&(!inetMpVpLock[code])) {
			
			
			if(inetMpVpCurPage[code] < intPage) {
				if((intPage - inetMpVpCurPage[code]) > 1) {
					inetMpVpSlideSelect(intPage,code,'left');
				}
				else {
					inetMpVpSlideLeft(code);
				}
			}
			else {
				if((inetMpVpCurPage[code] - intPage) > 1) {
					//cnnMpVpSlideDoubleRight();
					inetMpVpSlideSelect(intPage,code,'right')
				}
				else {
					inetMpVpSlideRight(code);
				}
			}
		}
	}

	function inetLockMpVp( intDur,code ) {
		
		var inetLockDur = 500;
		inetMpVpLock[code] = true;
		if(document.getElementById('dn_pageLoad'+code+'DIV'))
			document.getElementById('dn_pageLoad'+code+'DIV').innerHTML='<img src="'+vsubpath+'/isimage/blackLoading.gif" />';
		if(document.getElementById('dn_pageLoad'+code+'DIV2'))
			document.getElementById('dn_pageLoad'+code+'DIV2').innerHTML='<img src="'+vsubpath+'/isimage/ajax-loader.gif" />';

		setTimeout(function() { 
			
			
				inetMpVpLock[code] = false;
			if(document.getElementById('dn_pageLoad'+code+'DIV'))
			document.getElementById('dn_pageLoad'+code+'DIV').innerHTML=''; 
			if(document.getElementById('dn_pageLoad'+code+'DIV2'))
			document.getElementById('dn_pageLoad'+code+'DIV2').innerHTML=''; 
			if(document.getElementById('inetMpVid'+code+'NUM1'))
				document.getElementById('inetMpVid'+code+'NUM1').innerHTML=inetMpVpCurPage[code]+'/'+MpVpNum[code];
			if(document.getElementById('inetMpVid'+code+'NUM2'))
				document.getElementById('inetMpVid'+code+'NUM2').innerHTML=inetMpVpCurPage[code]+'/'+MpVpNum[code];	
			
			setMpBg(code,inetMpVpLastPage[code],'set',inetMpVpLastType[code]);
			
			},inetLockDur);
	}
	
	function setMpBg(code,nowind,type,type2){
		if(MpVpNew[code]){
			curInd=nowind-1;
			if(curInd<0)
				curInd=MpVpNum[code]-1;
			
			nextInd=nowind+1;
			if(nextInd>=MpVpNum[code])
				nextInd=0;
			if( type2=='right'){
				pind=-1;
				pind2=1;
				pk='-';
			}
			else{
				pind=1;
				pind2=-1;
				pk='+';
			}
			
			mLeft=0;
			mLeft2=0;
			leftW=MpVpWidth[code]/2;
			
			if(type=='back' && MpPrev[code]){
				mLeft=MpPrev[code][curInd];
				mLeft2=MpNext[code][nextInd];
				
				MpPrev[code][curInd]=0;
				MpNext[code][nextInd]=0;
			}
			else
			if(type=='set' && document.getElementById('in_box'+code+'DIV'+nowind)){
				
				mLeft2=leftW*pind;
				mLeft=leftW*pind2;
				if(document.getElementById('in_box'+code+'DIV'+curInd)){
					MpPrev[code][curInd]=document.getElementById('in_box'+code+'DIV'+curInd).style.left.split('px')[0]*1;
				}
				if(document.getElementById('in_box'+code+'DIV'+nextInd)){
					MpNext[code][nextInd]=document.getElementById('in_box'+code+'DIV'+nextInd).style.left.split('px')[0]*1;
				}
			}
			
	
			if(document.getElementById('in_box'+code+'DIV'+curInd) && curInd!=nowind && mLeft!=0){
				document.getElementById('in_box'+code+'DIV'+curInd).style.left=mLeft+'px';
				
			}
			
			if(document.getElementById('in_box'+code+'DIV'+nextInd) && nextInd!=nowind && mLeft2!=0){
				document.getElementById('in_box'+code+'DIV'+nextInd).style.left=mLeft2+'px';
			}
		}
	
	}
	
	function updateDesc(code,currentind,nowind){
		//setMpBg(code,nowind,'set','left');
		
		if(MpVpNew[code]){
			$('#in_box'+code+'DIV'+currentind).removeClass('selected');
			
			var descTitleH=$('#inet_'+code+'Title_'+nowind).height(),newelPa=$('#in_box'+code+'DIV'+nowind).height();
			
			if(inetMpVpTitleHeight[code] && inetMpVpTitleHeight[code]>0 && document.getElementById('inet_'+code+'Title_'+currentind) && document.getElementById('inet_'+code+'Title_'+currentind).className.indexOf('blocked')!=-1){
				
				//moveintV=document.getElementById('inet_'+code+'Title_'+currentind).style.top.split('px')[0]*1+inetMpVpTitleHeight[code];	
				//document.getElementById('inet_'+code+'Title_'+currentind).style.top=moveintV+'px';
				
				document.getElementById('inet_'+code+'Title_'+currentind).style.left='-1000px';
				
				$('#inet_'+code+'Title_'+currentind).removeClass('blocked');
			}
				
			if(inetMpVpTitleHeight[code] && inetMpVpTitleHeight[code]>0 && document.getElementById('inet_'+code+'Title_'+nowind) && document.getElementById('inet_'+code+'Title_'+nowind).className.indexOf('blocked')==-1){
					document.getElementById('inet_'+code+'Title_'+nowind).style.left = "0px";
					//alert(document.getElementById('inet_'+code+'Title_'+nowind).style.top);
					//moveintV=document.getElementById('inet_'+code+'Title_'+nowind).style.top.split('px')[0]*1-inetMpVpTitleHeight[code];
					//document.getElementById('inet_'+code+'Title_'+nowind).style.top = moveintV+"px";
					var newHBB=$('#in_box'+code+'DIV'+nowind).height()-70;
					$('#inet_'+code+'Title_'+nowind).css('top',newHBB+'px');
	
			}
			$('#in_box'+code+'DIV'+nowind).addClass('selected');
			$('#inet_'+code+'Title_'+nowind).addClass('blocked');
			
			//if(httphost=="photo.inet.mn" && code=='gallery'){
				//.in2_boxPage
				//alert($('#inet_'+code+'Title_'+nowind).outerHeight());
				var neDescTitleH=newelPa+descTitleH*1;
				if(descTitleH>64){
					
				}
				else{
					neDescTitleH=newelPa;
				}
				$('.in2_boxPage').height(neDescTitleH+'px');
				//$('#inet_'+code+'Title_'+nowind).css('top','532px');
			//}
		}
	}
	
	function inetMpslideAnimate(code,saveSW2,mPage2,saveSW1,mPAge){
		if(saveSW2!=0){
			$('#in_box'+code+'DIV'+mPage2).animate({"left": "+="+saveSW2+"px"}, 300);
		}
		if(saveSW1!=0){
			$('#in_box'+code+'DIV'+mPAge).animate({"left": "+="+saveSW1+"px"}, 300);
		}	
	}
	
	function inetMpVpSlideLeft(code) {
		
		inetLockMpVp(MpVpimg[code],code);
		
		mPAge=inetMpVpCurPage[code];
		mPage2=inetMpVpCurPage[code]-1;
		
		setMpBg(code,mPage2,'back','left');
		saveSW1=0;
		saveSW2=0;
		for(j=0;j<MpVpNum[code];j++){
			setmpW=MpVpWidth[code]*(-1);	
			
			if(mPAge==j || mPage2==j){
					
				if(mPAge==j){
					saveSW1=setmpW;
				}
				else
					saveSW2=setmpW;
			}
			else{
				if(document.getElementById('in_box'+code+'DIV'+j)){
					moveintV=document.getElementById('in_box'+code+'DIV'+j).style.left.split('px')[0]*1+setmpW;	
					document.getElementById('in_box'+code+'DIV'+j).style.left=moveintV+'px';
				}
			}
		}
		inetMpVpLastPage[code]=mPAge;
		inetMpVpLastType[code]='left';
		
		inetMpslideAnimate(code,saveSW2,mPage2,saveSW1,mPAge)
		
		updateDesc(code,mPage2,mPAge);
		
		inetMpVpCurPage[code]++;
		inetMpVpMoveDot(code);
		inetMpVpUpdateBtns(code);
	}
	
	function inetMpVpSlideRight(code) {
		inetLockMpVp(MpVpimg[code],code);

		mPAge=inetMpVpCurPage[code]-2;
		mPage2=inetMpVpCurPage[code]-1;
		setMpBg(code,mPage2,'back','left');
		saveSW1=0;
		saveSW2=0;
		for(j=0;j<MpVpNum[code];j++){
			setmpW=MpVpWidth[code]*(-1);
			if(mPAge==j || mPage2==j){
				
				if(mPAge==j){
					saveSW1=MpVpWidth[code];
				}
				else
					saveSW2=MpVpWidth[code];
			}
			else{
				if(document.getElementById('in_box'+code+'DIV'+j)){
					moveintV=document.getElementById('in_box'+code+'DIV'+j).style.left.split('px')[0]*1+MpVpWidth[code]*1;
					document.getElementById('in_box'+code+'DIV'+j).style.left=moveintV+'px';
				}
			}
		}
		inetMpVpLastPage[code]=mPAge;
		inetMpVpLastType[code]='left';
		//setMpBg(code,mPAge,'set','left');
		inetMpslideAnimate(code,saveSW2,mPage2,saveSW1,mPAge)
		updateDesc(code,mPage2,mPAge);
		
		inetMpVpCurPage[code]--;
		inetMpVpMoveDot(code);
		inetMpVpUpdateBtns(code);
	}
	
	function inetMpVpSlideSelect(intPage,code,type) {
				
		if(type=='left'){
			indexT=-1;
			moveint=intPage - inetMpVpCurPage[code];
			moveint2=intPage - 1 - inetMpVpCurPage[code];
		}
		else{
			indexT=1;
			moveint=inetMpVpCurPage[code] - intPage;
			moveint2=inetMpVpCurPage[code] - intPage-1;
		}
		
		lockint=MpVpimg[code]*moveint;
		
		inetLockMpVp(MpVpimg[code],code);
		widthint=MpVpimg[code]*moveint;
		durint=0.3*moveint;
		mPAge=intPage-1;
		mPage2=inetMpVpCurPage[code]-1;
		
		setMpBg(code,mPage2,'back',type);
		saveSW1=0;
		saveSW2=0;
		for(j=0;j<MpVpNum[code];j++){
			setmpW=MpVpWidth[code]*indexT*moveint;
			
			if(mPAge==j || mPage2==j){
	
				if(mPAge==j){

					saveSW1=MpVpWidth[code]*indexT*moveint2;
					if(document.getElementById('in_box'+code+'DIV'+j)){
						moveintV=document.getElementById('in_box'+code+'DIV'+j).style.left.split('px')[0]*1+saveSW1;
						document.getElementById('in_box'+code+'DIV'+j).style.left=moveintV+'px';
					}
					saveSW1=MpVpWidth[code]*indexT;
				}
				else{
			
					saveSW2=setmpW;
				}
				
			}
			else{
				if(document.getElementById('in_box'+code+'DIV'+j)){
					moveintV=document.getElementById('in_box'+code+'DIV'+j).style.left.split('px')[0]*1+setmpW;	
					document.getElementById('in_box'+code+'DIV'+j).style.left=moveintV+'px';
				}
			}
		}
		inetMpVpLastPage[code]=mPAge;
		inetMpVpLastType[code]=type;
		//setMpBg(code,mPAge,'set',type);
		inetMpslideAnimate(code,saveSW2,mPage2,saveSW1,mPAge)
		
		updateDesc(code,mPage2,mPAge);
			
		if(type=='left'){
			inetMpVpCurPage[code]=inetMpVpCurPage[code]+moveint;
		}
		else{
			inetMpVpCurPage[code]=inetMpVpCurPage[code]-moveint;
		}
		inetMpVpMoveDot(code);
		inetMpVpUpdateBtns(code);
	}
	
	
	function inetMpDotMouseOver( id ) {
		if(document.getElementById(id))
		document.getElementById(id).src = vsubpath+'/isimage/main/status1.jpg';
		//$(id).src = vsubpath+'/isimage/main/status1.jpg';
	}
	
	function allImageLoadInet(code){
		
		mydivindsho=inetMpVpCurPage[code]-1;
	
		for(jf=mydivindsho;jf<=MpVpNum[code];jf++){
	
			if(document.getElementById('in_box'+code+'DIV'+jf)){
				
				inetImgind=0;
				var searchdivs=document.getElementById('in_box'+code+'DIV'+jf);
				while(searchdivs.getElementsByTagName('img')[inetImgind]){
					if(searchdivs.getElementsByTagName('img')[inetImgind].src.indexOf(vsubpath+"/isimage/s.gif#")!= -1){
	
						var imgEle=searchdivs.getElementsByTagName('img')[inetImgind];
						imgEle.id="loadImg"+jf;
						$('<img src="'+imgEle.src.split(vsubpath+"/isimage/s.gif#")[1]+'" alt="Loading ..." width="'+$("#loadImg"+jf).attr('width')+'" height="'+$("#loadImg"+jf).attr('height')+'"  >').insertBefore("#loadImg"+jf);
	
						$("#loadImg"+jf).remove();
						
						
					}
					inetImgind++;
				}
			}
		}
	}
	
	
	function inetMpVpMoveDot(code) {
		setCookie(code,inetMpVpCurPage[code],1);
		mydivindsho=inetMpVpCurPage[code]-2;
	
		for(jf=mydivindsho;jf<=inetMpVpCurPage[code]+1;jf++){

			if(document.getElementById('in_box'+code+'DIV'+jf)){
				
				inetImgind=0;
				var searchdivs=document.getElementById('in_box'+code+'DIV'+jf);
				while(searchdivs.getElementsByTagName('img')[inetImgind]){
					if(searchdivs.getElementsByTagName('img')[inetImgind].src.indexOf(vsubpath+"/isimage/s.gif#")!= -1){

						var imgEle=searchdivs.getElementsByTagName('img')[inetImgind];
						imgEle.id="load"+code+"Img"+jf+"_"+inetImgind;
						
						$("#load"+code+"Img"+jf+"_"+inetImgind).wrap('<div id="loadN'+code+'Img'+jf+'_'+inetImgind+'" />');
						
						var nImhtml=$("#loadN"+code+"Img"+jf+"_"+inetImgind).html();
						
						nImhtml=nImhtml.replace(vsubpath+"/isimage/s.gif#",'');
						
						$("#load"+code+"Img"+jf+"_"+inetImgind).remove();
						
						$("#loadN"+code+"Img"+jf+"_"+inetImgind).html(nImhtml);
	
					}
					inetImgind++;
				}
			}
		}
	
		forint=MpVpNum[code]+1;
		for(i=1;i<forint;i++) {
			
			if(document.getElementById('inetMpVid'+code+'Dot'+i)){
				var scDot=document.getElementById('inetMpVid'+code+'Dot'+i);	
			
				scDot.src = vsubpath+'/isimage/main/'+code+'status0.jpg';
				scDot.onmouseover = function() {this.src = vsubpath+'/isimage/main/'+code+'status1.jpg';}
				scDot.onmouseout = function() {this.src = vsubpath+'/isimage/main/'+code+'status0.jpg';}
			}
			else{
				if(document.getElementById('inetMpVid'+code+'2Dot'+i)){
					var scDot=document.getElementById('inetMpVid'+code+'2Dot'+i);
					scDot.style.borderWidth = 0;
					
				}
				else
					if(document.getElementById('inetMpVid'+code+'3Dot'+i)){	
						$('#inetMpVid'+code+'3Dot'+i).removeClass('in2_boxgalleryPage2');
						$('#inetMpVid'+code+'3Dot'+i).addClass('in2_boxgalleryPage');
					}
			}
		}
		if(document.getElementById('inetMpVid'+code+'Dot'+inetMpVpCurPage[code])){
			var scDot=document.getElementById('inetMpVid'+code+'Dot'+inetMpVpCurPage[code]);	
			scDot.src = vsubpath+'/isimage/main/'+code+'status1.jpg';
			scDot.onmouseover = function() {}
			scDot.onmouseout = function() {}
		}
		else{
			if(document.getElementById('inetMpVid'+code+'2Dot'+inetMpVpCurPage[code])){		
				var scDot=document.getElementById('inetMpVid'+code+'2Dot'+inetMpVpCurPage[code]);	
				scDot.style.borderWidth=1;			
			}
			else
				if(document.getElementById('inetMpVid'+code+'3Dot'+inetMpVpCurPage[code])){	
		
					$('#inetMpVid'+code+'3Dot'+inetMpVpCurPage[code]).removeClass('in2_boxgalleryPage');
					$('#inetMpVid'+code+'3Dot'+inetMpVpCurPage[code]).addClass('in2_boxgalleryPage2');
				}
		
		}
		
	}
	function inetMpVpUpdateBtns(code) {
		if(document.getElementById('inetMpVid'+code+'BtnL')){
		
			var scLeftButton=document.getElementById('inetMpVid'+code+'BtnL');
			var scLRightButton=document.getElementById('inetMpVid'+code+'BtnR');
			
			if(inetMpVpCurPage[code] > 1) {
				$('#inetMpVid'+code+'BtnL').css('cursor','auto');
				scLeftButton.src = vsubpath+'/isimage/main/'+code+'leftbtn3.jpg';
				scLeftButton.onmouseover = function() { this.src=vsubpath+'/isimage/main/'+code+'leftbtn2.jpg'; }
				scLeftButton.onmouseout = function() { this.src=vsubpath+'/isimage/main/'+code+'leftbtn3.jpg'; }
			}
			else {
				
				$('#inetMpVid'+code+'BtnL').css('cursor','default');
				scLeftButton.src = vsubpath+'/isimage/main/'+code+'leftbtn1.jpg';
				scLeftButton.onmouseover = function() {}
				scLeftButton.onmouseout = function() {}
			}
		
			if(inetMpVpCurPage[code] < MpVpNum[code]) {
				$('#inetMpVid'+code+'BtnR').css('cursor','auto');
				scLRightButton.src = vsubpath+'/isimage/main/'+code+'rightbtn3.jpg';
				scLRightButton.onmouseover = function() {this.src = vsubpath+'/isimage/main/'+code+'rightbtn2.jpg';}
				scLRightButton.onmouseout = function() {this.src = vsubpath+'/isimage/main/'+code+'rightbtn3.jpg';}
			}
			else {
				
				$('#inetMpVid'+code+'BtnR').css('cursor','default');
				scLRightButton.src = vsubpath+'/isimage/main/'+code+'rightbtn1.jpg';
				scLRightButton.onmouseover = function() {}
				scLRightButton.onmouseout = function() {}
			}
		}
	
		if(typeof(sliderUpdate)=="function")	
			sliderUpdate(code);
	}


	function jsReplaceDate(odate,odate2,otime,rcode){
		var now = new Date();
		
		var month = now.getMonth() + 1;
		if(month<10)
			month='0'+month;
		var day=now.getDate();
		if(day<10)
			day='0'+day;
		nowDate=now.getFullYear()+'-'+month +'-'+day;
		nowTime=now.getHours()+':'+now.getMinutes() +':00';
		var retval='';
		if(nowDate==odate || nowDate==odate2){
			
			
			var fdateH=0;
	
				dateM=odate.split('-')[1]*1-1;
				var inodate = new Date(odate.split('-')[0],dateM,odate.split('-')[2],otime.split(':')[0],otime.split(':')[1],otime.split(':')[2]);
				
				var fmktime2=inodate.getTime();
				
	
			var fmktime3=now.getTime();

			var fmktime4=fmktime3-fmktime2;
			var one_day=1000*60*60*24;
			
			if(fmktime4<one_day){
				fdateH=parseInt(fmktime4/(1000*60*60));
				fdateH4=fmktime4-fdateH*1000*60*60;
				fdateI=parseInt(fdateH4/(1000*60));
				if(fdateH>0)	
					retval='<span class="inc_infodate2" >'+fdateH+' цаг '+fdateI+' минутийн өмнө</span>';
				else
					retval='<span class="inc_infodate2" >'+fdateI+' минутын өмнө</span>';
			}
			else
				retval=odate+' '+otime;	
		}
		else			
			retval=odate+' '+otime;

		var elname=odate.replace(/-/gi,'')+'_'+otime.replace(/:/gi,'')+'_'+rcode;

		if(document.getElementById(elname))
			document.getElementById(elname).innerHTML=retval;
	}
	
	function weatherDate(odate,code,ele){
		var now = new Date();
		
		var month = now.getMonth() + 1;
		if(month<10)
			month='0'+month;
		var day=now.getDate();
		if(day<10)
			day='0'+day;	
		nowDate=now.getFullYear()+'-'+month +'-'+day;
		
		if(nowDate!=odate){
			ajaxpage(vsubpath+'/dchange.php?bc='+code+'&chdate='+odate, ele);
		}
	}
	
	
	/******* Alert MSG START 2009-05-19 ***********/
	
	function alertshow(otit,otext){	
		window.scrollTo(0,0);
		if (parseInt(navigator.appVersion)>3) 
		{
			 if (navigator.appName=="Netscape") 
			 {
				  winW = window.innerWidth;					 
				  winH = window.innerHeight;
			 }
			else
			 if (navigator.appName.indexOf("Microsoft")!=-1 ) 
			 {
				  winW = document.body.offsetWidth;					  
				  winH = document.body.offsetHeight;
			 }
			else
			 if(window.XMLHttpRequest)
			 {
				if(document.body.offsetHeight)
				 winH = document.body.offsetHeight;
				if(window.innerWidth)
				 winW = window.innerWidth;
			 }
			 			 			 
		}
	
		newPosX=(winW-600)/2;
		newPosY=100;
		if(document.getElementById('ext-comp-MSG1002')){
			
			if(document.getElementById('ext-genMSG57') && otit!=''){
				document.getElementById('ext-genMSG57').innerHTML=otit;
			}
			if(document.getElementById('ext-genMSG68') && otext!=''){
				document.getElementById('ext-genMSG68').innerHTML=otext;
			}
			if(document.getElementById('ext-genMSG56')){
				document.getElementById('ext-genMSG56').setAttribute("width",winW);
				document.getElementById('ext-genMSG56').setAttribute("height",winH);	
				document.getElementById('ext-genMSG56').style.display='block';
			}
			
			
			document.getElementById('ext-comp-MSG1002').style.top=newPosY+'px';
			document.getElementById('ext-comp-MSG1002').style.left=newPosX+'px';
			document.getElementById('ext-comp-MSG1002').style.visibility='visible';
			
		}
	}
	
	function alertclose(){
		if(document.getElementById('ext-comp-MSG1002')){			
			document.getElementById('ext-comp-MSG1002').style.top='-1000px';
			document.getElementById('ext-comp-MSG1002').style.left='-1000px';
			document.getElementById('ext-comp-MSG1002').style.visibility='hidden';
			document.getElementById('ext-genMSG56').style.display='none';
		}	
	}
	
	
	function alertchange(otype){
		
		if(otype=='alert'){
			if(document.getElementById('ext-genMSGOK21')){		
				document.getElementById('ext-genMSGOK21').className='x-panel-btn-td';
				document.getElementById('ext-genMSGCANCEL45').className='x-panel-btn-td x-hide-offsets';
				document.getElementById('ext-genMSGlogo').className='ext-mb-fix-cursor';
			}	
		}
		else
			if(otype=='window'){
				if(document.getElementById('ext-genMSGOK21')){		
					document.getElementById('ext-genMSGOK21').className='x-panel-btn-td x-hide-offsets';
					document.getElementById('ext-genMSGCANCEL45').className='x-panel-btn-td';
					document.getElementById('ext-genMSGlogo').className='';
				}
			}
			else
				if(otype=='form'){
					if(document.getElementById('ext-genMSGOK21')){		
						document.getElementById('ext-genMSGOK21').className='x-panel-btn-td x-hide-offsets';
						document.getElementById('ext-genMSGCANCEL45').className='x-panel-btn-td x-hide-offsets';
						document.getElementById('ext-genMSGlogo').className='';
					}
				}
	}


	/******* Alert MSG END ***********/	
	
	Global = {
FixPng: function( img ){
if(document.all){
img.parentNode.style.width = img.offsetWidth;
img.parentNode.style.height = img.offsetHeight;
img.parentNode.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='"+ img.src +"')"
} else {
img.style.visibility = "visible"
}
},

FixPng2: function(img){
	if(document.getElementById(img)){
		var tEl=document.getElementById(img);
		if(document.all){
			tEl.className=tEl.className+'IE';
			//alert(tEl.className);
		}
		else{
		}
	}
}

}


	function tconload(){
	
		  var top_position = getCookie('topPos');
		  var urlstr=window.location.toString();
		 
		  if(urlstr.indexOf('&topposition=yes')!=-1)
		  window.scrollTo(0,top_position);
	}
	
	function tconunload(){
		
		var top_position = document.documentElement.scrollTop;
		setCookie('topPos',top_position,1);
	}
		 
